Answer:
Following are the constructor to the given code:
Bug(int position) //defining a constructor that defines a integer parameters
{
this.position = position;//use this key word to hold parameter value
right = true;//defining a variable right that hold a boolean value
}
Explanation:
In this code, a constructor is declared that defines integer parameters with it, Inside the constructor, this keyword is used to holds the "position" parameter value and defines a boolean variable "right" that holds a boolean value.
Full program:
public class Bug //declaring a class Bug
{
private int position;//declaring integer variable position
private boolean right;//declaring boolean variable
public Bug(int position) //defining a parameterized constructor
{
this.position = position;//use this to hold position value
right = true;//holding boolean value
}
public void turn() //defining a method turn
{
right = !right;//holding value
}
public void move() //defining method move
{
if(right)//use if to check boolean value
{
position++;//incrementing position value
}
else//else block
{
position--;//decreasing position value
}
}
public int getPosition()//defining method getPosition
{
return position;//return position value
}
public static void main(String[] args) //main method
{
Bug bug = new Bug(10);//creating class object
System.out.println("Expected = 10, Actual = " + bug.getPosition());//calling method with printing value
bug.move();//calling method
System.out.println("Expected = 11, Actual = " + bug.getPosition());//calling method with printing value
bug.move();//calling method
bug.move();//calling method
bug.move();//calling method
System.out.println("Expected = 14, Actual = " + bug.getPosition());//calling method with printing value
bug.turn();//calling method
bug.move();//calling method
bug.move();//calling method
System.out.println("Expected = 12, Actual = " + bug.getPosition());//calling method with printing value
bug.turn();//calling method
bug.move();//calling method
System.out.println("Expected = 13, Actual = " + bug.getPosition());//calling method with printing value
}
}
Output:
Please find the attached file.
Does anyone know how to fix this? Everytime i make a new page it only types in the middle of the page. I want to type at the top
Answer:maybe start a new page or try hitting delete
Explanation:
what are three limitations of computer?
Answer:
Explanation:
Three limittaions of computer are:
It requires reqular power supply to operate .
It needs instructions to perform a task.
It cannot memorize and recall.
Write a program second.cpp that takes in a sequence of integers, and prints the second largest number and the second smallest number. Note that in the case of repeated numbers, we really mean the second largest and smallest out of the distinct numbers (as seen in the examples below). You may only use the headers: and .
Answer:
The program is as follows:
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
cout<<"Elements: ";
cin>>n;
vector <int>vectnum;
int numInp;
for (int i = 1; i <= n; i++){ cin>>numInp; vectnum.push_back(numInp); }
int big, secbig;
big = vectnum.at(0); secbig = vectnum.at(1);
if(vectnum.at(0)<vectnum.at(1)){ big = vectnum.at(1); secbig = vectnum.at(0); }
for (int i = 2; i< n ; i ++) {
if (vectnum.at(i) > big) {
secbig = big;;
big = vectnum.at(i);
}
else if (vectnum.at(i) > secbig && vectnum.at(i) != big) {
secbig = vectnum.at(i);
}
}
cout<<"Second Largest: "<<secbig<<endl;
int small, secsmall;
small = vectnum.at(1); secsmall = vectnum.at(0);
if(vectnum.at(0)<vectnum.at(1)){ small = vectnum.at(0); secsmall = vectnum.at(1); }
for(int i=0; i<n; i++) {
if(small>vectnum.at(i)) {
secsmall = small;
small = vectnum.at(i); }
else if(vectnum.at(i) < secsmall){
secsmall = vectnum.at(i); } }
cout<<"Second Smallest: "<<secsmall;
return 0;
}
Explanation:
See attachment for explanation
A compound Boolean expression created with the _________ operator is true if either of its subexpressions is true.
The following are three possible logon scenarios. Explain why option (c) below is preferable in terms of system security. a. Welcome to XYZ computing Enter username: jones Invalid username Enter username: b. Welcome to XYZ computing Enter username: smith Enter password: password Invalid access Enter username: c. Enter username: smith Enter password: password Invalid access Enter username: smith Enter password: FpQr56 Welcome to XYZ computing
Answer:
because the password being used is of high quality
Explanation:
Option C is the most preferable in terms of system security because the password being used is of high quality. Meaning that it contains lower case and capital case letters as well as numbers. It is also a random mix of all three and is not a common word or name. The length of the password is normal but could be longer for better safety. These things make it very difficult and time-consuming for a software program to guess the password, and nearly impossible for an individual to guess.
Which of the following passes an int argument into a method named print? Chose one option and explain why.
o print();
o print()+5;
o print("5");
o print(5);
Answer:
print(5)
Explanation:
Passing an int argument into the method named print ;
print() ; Here, the print method has no argument as it is empty
print()+5; Here also, the print method has no argument and adding +5 is an invalid syntax.
print("5") ; Here, print takes in an argument, however, the argument is a string due to the fact that 5 is enclosed by quotation marks.
print(5) ; Here, the integer is 5 is passed to the print method.
Write a program to prompt the user for hours worked to compute a gross pay for an employee, and he is paid 100/hour. If he worked for 50 hours in a week then he will get overtime pay for the extra hours he worked i.e. he will be paid 1.5 times of M100.00 for 10 hours (50-40)
Answer:
rate = 100
hours_worked = eval(input('enter number of hours worked'))
gross_pay = hours_worked * rate
if hours_worked <= 40 :
print(gross_pay)
else:
print(gross_pay + (1.5*rate*(hours_worked -40)))
Explanation:
Using python 3 :
The rate of pay is defined using the rate variable
The user is the prompted to enter the number of hours worked.
Gross_pay gives the mathematical evaluation of the amount paid base in rate and hours worked.
Since hours beyond 40 are paid as overtime. Then we have to add that to those who worked above 40 hours.
If hours_worked is 40 and below, then use gross pay
If gross pay is above 40 ; then the overtime fee is added to gross pay using the rate provided.
Write a program that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate's name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election.
i have this
#include
#include
#include
using namespace std;
int findMax(int votes[]);
void main()
{
int votes[20];
string name[10];
int total=0;
float percent[10];
int m, i, loc;
cout<<"Enter the names of candidates in local election and number of votes:"<
for(int i=0;i<5;i++)
{
cin>>name[i];
cin>>votes[i];
}
for(i=0;i<5;i++)
{
total=total+votes[i];
}
for(i=0;i<5;i++)
{
percent[i]=((votes[i]/total)*100);
}
cout<<"Candidate"<<'\t'<<"VotesReceived"<<'\t'<<"% of Total Votes"<
cout<
for(i=0;i<5;i++)
{
cout<
}
cout<<"Total:"<
m=findMax(votes);
cout<<"Winner of the election is"<
system("pause");
}
int findMax(int votes[])
{
int i,max,loc;
max=votes[0];
for(i=1;i<5;i++)
{
if(votes[i]>max)
{
max=votes[i];
loc=i;
}
}
return loc;
}
But, it is saying that loc is not initialized, and it is also not calculating % of total votes or the winner of the election and I don't what to do to fix it.
Answer:
The following fix were made to the program
Change void main() to int main(), then set a return value at the end of the main function; e.g. return 0Remove system("pause"); It's not neededFor each of the array, change their lengths to 5 i.e. int votes[5]; string name[5]; and float percent[5];Lastly, calculate the percentage using: percent[i]=((votes[i]*100.0/total))Explanation:
(1) void main implies that the main function will not return any value. So, you change it to int main() and then set the return value
(2) There is no need to pause the program, so system.("pause") is not necessary.
(3) The question says there are 5 candidates. So, we set the arrays to accommodate inputs for 5 values
(4) percent array is declared as float; 100.0 will ensure that it calculates the percentage as a float value.
See attachment for updated code
what is mobile computing
Explanation:
Mobile computing is human–computer interaction in which a computer is expected to be transported during normal usage, which allows for the transmission of data, voice, and video. Mobile computing involves mobile communication, mobile hardware, and mobile software. ... Hardware includes mobile devices or device components.
Question: what is mobile computing
Answer:
Mobile computing is human–computer interaction in which a computer is expected to be transported during normal usage, which allows for the transmission of data, voice, and video. Mobile computing involves mobile communication, mobile hardware, and mobile software. Communication issues include ad hoc networks and infrastructure networks as well as communication properties, protocols, data formats, and concrete technologies. Hardware includes mobile devices or device components. Mobile software deals with the characteristics and requirements of mobile applications.Explanation:
Hope it helps
#CarryOnLearning
Claire needs to make an SRS document. Help her identify the given section and subsection.
The ___ subsection mentions the list of factors that may influence the requirements specified in the SRS. This subsection is part of the section named ___
Blank 1:
A. Scope
B. Purpose
C. Assumptions
Blank 2:
A. Introduction
B. General Description
C. Specific Requirements
Answer:
C and B in that order
Explanation:
Which of the following are properties of dictionaries? (check all that apply) nestable accessed by key iterable ordered
Answer:
Both are mutable.
Both are dynamic. They can grow and shrink as needed.
Both can be nested. A list can contain another list. A dictionary can contain another dictionary. A dictionary can also contain a list, and vice versa
Explanation:
hope it's help
In computers, language dictionaries are the unordered collections of the data set. Dictionaries can be nestable. Thus, option a is correct.
What is nestable?Nestable is the ability to get nested that is the fitting of many objects together at a place. The items like the files, documents, folders, etc. can be placed and stacked within each other.
The different or the same type of computing items can be embedded and arranged in a hierarchical form. The other words do not fit with the computing dictionaries.
Therefore, option a. nestable is the correct option.
Learn more about dictionaries here:
https://brainly.com/question/15288419
#SPJ2
Create a basic program that accomplishes the following requirements: Allows the user to input 2 number , a starting number x and ending number y Implements a while loop that counts from x (start) to y(end). Inside the loop , print to the screen rather the current number is even or odd If the number is even , multiply by the number by 3 and print the results to the screen. If the number is odd , add 10 and print the results to the screen. Use at least 1 increment or decrement operator.
Answer:
Explanation:
The following program is written in Java. It asks the user for the two inputs and then uses those inputs in a for loop. The loop goes through each number checking to see if it is even or odd. If it is even it prints out Even: and the number after multiplying it by 3. If it is odd it prints out Odd: and the number after adding 10 to it. The output can be seen in the attached picture below.
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter number 1: ");
int num1 = in.nextInt();
System.out.println("Enter number 2:");
int num2 = in.nextInt();
for (int x = num1; x <= num2; x++) {
if ((x % 2) == 0) {
System.out.println("Even: " + (x*3));
} else {
System.out.println("Odd: " + (x+10));
}
}
}
}
HEEELLPPPPP, ILL GIVE THE BRAIN THING
Which entry by the user will cause the program to halt with an error statement? # Get a guess from the user and update the number of guesses. guess = input("Guess an integer from 1 to 10:") guess = int(guess)
7
-1
5.6
36
what is computer software
Answer:Software is a collection of instructions and data that tell a computer how to work. This is in contrast to physical hardware, from which the system is built and actually performs the work. Wikipedia
Explanation:
tool that help to monitor the ongoing performance of the platform for Accenture
Answer:
MyConcerto
Explanation:
Accenture may be described as an industry leader which renders professional services capable of solving various business problems by leveraging the use technology involving data and business intelligence to proffer solutions to their clients needs. The MyConcerto firmly known as the Accenture Intelligence Enterprise platform is designed to continously help businesses measure performance, identify shortfalls and proffer solutions using data driven insight. It offered a fully automated platform with predefined solutions geared at accelerating business decisions and adaptive solution.
MyConcerto is a tool which helps to monitor the ongoing performance of the
platform for Accenture.
Myconcerto is a digital platform which brings together and incorporates
innovation and leadership qualities. It involves the use of technology and
solutions which results in exponential business outcomes.
These qualities help in the monitoring process of ongoing performance
which is available on Accenture.
Read more about Accenture here https://brainly.com/question/24937450
What is the purpose of this parallelogram shape in a flowchart?
Answer: Parallelogram A parallelogram is used to read data (input) or to print data (output). Rectangle A rectangle is used to show the processing that takes place in the flowchart. Diamond A diamond with two branches is used to show the decision making step in a flowchart.
HOPE THIS HELPS!!
Please help it’s timed
Answer:
2nd, third, and the 5th one
Explanation:
Rewrite the following function so that it returns the same result, but does
not increment the variable ptr. Your new program must not use anysquare brackets, but must use an integer variable to visit each double in the array. You may eliminate any unneeded variable.
double computeAverage(const double* scores, int nScores)
{
const double* ptr = scores;
double tot = 0;
while (ptr != scores + nScores)
{
tot += *ptr; } ptr++;
}
return tot/nScores;
Answer:
одиннадцать обречены и
Explanation:
переписать это как один из следующих
Briefly explain the mapping of human thinking to artificial intelligence components?
Answer:
The technique is mind mapping and involves visual representation of ideas and information which makes it easier to remember and memorize facts even in complex subjects. Here is an example of a mind map with the essential elements of AI and the industries where Artificial Intelligence is applied.
Artificial is a term utilized to elaborate something that isn't natural or we can say unnatural (opposite to natural). Whereas, definition of "intelligence" is a bit complex as the term enclose many different and specific corporeal tasks, like learning, problem-solving, reasoning, perception, and language understanding.
Mind mapping technique involves the representation of information and ideas visually which concludes in much easier and friendly way to remember and imprints the facts even in complex subjects.
Below is the example in how the A.I applies in fields like health care, educations, financials etc.
Learn More:
https://brainly.com/question/23131365?referrer=searchResults
Which of the following class definition defines a legal abstract class Group of answer choices public class Rectangle abstract { public abstract double findArea ( ); } public abstract class Rectangle { public abstract double findArea ( ); } public class Rectangle { public abstract double findArea ( ); } public class abstract Rectangle { public abstract double findArea ( ); }
Which of the following class definition defines a legal abstract class Group of answer choices
(a)
public class Rectangle abstract {
public abstract double findArea ( );
}
(b)
public abstract class Rectangle {
public abstract double findArea ( );
}
(c)
public class Rectangle {
public abstract double findArea ( );
}
(d)
public class abstract Rectangle {
public abstract double findArea ( );
}
Answer:
(b)
public abstract class Rectangle {
public abstract double findArea ( );
}
Explanation:When a class is declared with the abstract keyword, the class is called an abstract class. Abstract classes cannot be instantiated and may include one or more abstract methods. If a class contains an abstract method, then it (the class) must be declared abstract.
In Java, abstract classes are defined using the following format:
[access_modifier] abstract class [name_of_class]
[access_modifier] specifies the access modifier of the class which could be public, private, e.t.c
abstract is the keyword that specifies that the class is an abstract class.
class is a keyword used for defining classes
name_of_class specifies the name of the class.
The only option that fulfils this format is option b where;
(i) The access modifier is public
(ii) The name of the class is Rectangle
Option a is not correct because the abstract keyword is supposed to come before the class keyword.
Option c is not correct because the keyword abstract is missing. In other words, the class must be declared abstract since it contains abstract method findArea();
Option d is not correct because the abstract keyword is supposed to come before the class keyword.
A programmer writes 500 lines of computer code in 17 days. Must there have been at least 1 day when the programmer wrote 30 or more lines of code
Answer:
The answer is No
Explanation:
Given data
Total Lines of code= 500
Number of days= 17 days
Number of codes written per day= 500/17
Number of codes written per day= 29.4117
If we multiply 29.4117 by 17
=499.9989
=500 approx
Hence there was never a day when the programmer wrote 30 or more lines
In a finite state machine, state transitions happen only: a. When the reset causes a clock pulse on the D outputs of the flip-flops. b. When the latches cause the Q inputs of the flip-flops to toggle. c. When there is a clock pulse. d. When the present state is the same as the next state. e. When the present state is causes the next state to reset.
Answer:
When the present state is causes the next state to reset. ( e )
Explanation:
A finite state machine is a machine that can only be a certain state out its finite number of states at a given time. Hence state transitions occurs in a Finite state machine when the present state is causes the next state to reset.
An Example of a Finite state machine is a Coin-operated turnstile :
In this Finite state machine the Input of Coin unlocks the machine hence resetting the next state ( i.e. the lock state ), while to activate the lock state you push the arm of the Turnstile which in turn will as well reset the unlock state ( previous state ).
three basic components to cloud computing are client, internet
Answer:
the basic components of cloud comuting in a simple topology
Your answer
Antivirus is a ........ software.
Answer: True
Explanation:
Software refers to the programs and other instructions which enable us to be able to execute tasks on a computer. Everything you see when you turn on the computer is software from the operating system to the browsers that you use.
An antivirus is no different. It is basically a software on the computer that is able to monitor the activities of other software to ensure that the computer does not get infected by malicious software.
Question # 6
Fill in the Blank
Complete the following sentence.
The World Wide Web launched to the public in
CERN released the code for the World Wide Web to the public on April 30, 1993. Subsequently, CERN made a release available under an open licence, which was a more reliable strategy for maximising its reach.
Which year was India's introduction to the World Wide Web?The first time the world wide web was ever made accessible to the general public on the Internet was on August 6, 1991. It has changed so little in 26 years from how it was then.
In 1994, what was invented?The IBM Simon, the first smartphone in history, goes on sale on August 16. The first PlayStation game console is made available in Japan on December 3. The first high-brightness blue LED is created, and the researchers are awarded the 2014 Nobel Prize for their discovery.
To know more about World Wide Web visit:-
https://brainly.com/question/20341337
#SPJ1
Write a program named split_me.py that accepts a string in the format Age.FirstName and returns the value FirstName is Age years old. Length of Mary is X. Example: 22.Mary >> Mary is 22 years old. Length of Mary is 4
age,name = input('Enter a string: ').split('.')
print(name+' is '+age+' years old. Length of '+name+' is '+str(len(name)))
I wrote my code in python 3.8. I hope this helps.
give one word • pressure exerted by a stationary liquid _______. • force in a direction perpendicular to a given surface area _______. • a pair of forces whose resultant is zero _______.
Answer:
1. Hydrostatic pressure.
2. Pressure.
3. Equilibrium forces.
Explanation:
1. Hydrostatic pressure: pressure exerted by a stationary liquid. It is simply the pressure in a liquid such as water at a specific depth.
Mathematically, hydrostatic pressure is given by the formula;
[tex] H.P = rho * g * d [/tex]
Where:
H.P is the hydrostatic pressure of a liquid.rho represents the density of a liquid.g is the acceleration due to gravity.d is the depth (height) of a liquid.2. Pressure: it is the force in a direction perpendicular to a given surface area. Thus, it's typically measured in Newton per meters (N/m²).
Mathematically, pressure is given by the formula;
[tex] Pressure = \frac {Force}{area} [/tex]
3. Equilibrium forces: a pair of forces whose resultant is zero. It is also referred to as balanced forces because the resultant of all the pair of forces acting on a body or system is at equilibrium (balanced).
A local router is configured to limit the bandwidth of guest users connecting to the Internet. Which of the following best explains the result of this configuration as compared to a configuration in which the router does not limit the bandwidth?
a. The amount of time it takes guest users to send and receive large files is likely to decrease.
b. The number of packets required for guest users to send and receive data is likely to decrease.
c. Guest users will be prevented from having fault-tolerant routing on the Internet.
d. Guest users will be restricted in the maximum amount of data that they can send and receive per second.
Answer:
The correct option is d. Guest users will be restricted in the maximum amount of data that they can send and receive per second.
Explanation:
Bandwidth can be described as the maximum data transfer that an internet connection or a network has. It gives a measure of the amount of data that can be transmitted over a particular connection in a particular amount of time. For instance, the capacity of a gigabit Ethernet connection is 1,000 megabits per second (Mbps) (which also translates to 125 megabytes per second).
Therefore, when a local router is configured to limit the bandwidth of guest users connecting to the Internet, it will restrict the the maximum amount of data that they can transmit per second.
Therefore, the correct option is d. Guest users will be restricted in the maximum amount of data that they can send and receive per second.
what the rule of pattern 1 4 9 16 25
(1)² = 1
(2)² = 4
(3)² = 9
(4)² = 16
(5)² = 25
Identify the correct statement regarding HTTP. a. Basic HTTP is a stateful protocol. b. In HTTP tunneling, some protocols travel inside HTTP traffic. c. It has been replaced with IPv6. d. It was developed by Al Gore.
Answer:
b. In HTTP tunneling, some protocols travel inside HTTP traffic.
Explanation:
a. HTTP is not a stateful protocol. It is a stateless protocol since the receiver is not allowed to store the state from previous requests. In other words, there is no need to keep track of the session information or status. Other examples of stateless protocol are UDP (User Datagram Protocol) and DNS (Domain Name System).
b. In HTTP tunneling, some protocols travel inside HTTP traffic. HTTP tunneling allows two devices to be connected together using network link with or without restrictions such as firewalls and access control lists. One way of implementing this HTTP tunneling is by using the regular HTTP methods such as POST, GET, PUT and DELETE.
In other words, HTTP tunneling allows certain protocols travel inside HTTP traffic.
c. HTTP has not been replaced with IPV6. They are different protocols performing different functions. IPV6 is an internet protocol addressing scheme invented to replace its predecessor IPV4.
d. HTTP was not developed by AI Gore. It was developed by Tim Berners-Lee and his team.