1 #include
2 using namespace std;
3
4 int main() {
5 int userNum;
6 int userNumSquared;
7
8 cin >> userNum;
9
10 userNumSquared = userNum + userNum; // Bug here; fix it
11
12 cout << userNumSquared; // Output formatting issue |
13
14 return 0;
15 }
16
While the zyLab platform can be used without training, a bit of training may help some students avoid common issues.
The assignment is to get an integer from input, and output that integer squared, ending with newline. (Note: This assignment is configured to have students programming directly in the zyBook. Instructors may instead require students to upload a file). Below is a program that's been nearly completed for you.
Click "Run program". The output is wrong. Sometimes a program lacking input will produce wrong output (as in this case), or no output. Remember to always pre-enter needed input.
Type 2 in the input box, then click "Run program", and note the output is 4.
Type 3 in the input box instead, run, and note the output is 6.
When students are done developing their program, they can submit the program for automated grading.
Click the "Submit mode" tab
Click "Submit for grading".
The first test case failed (as did all test cases, but focus on the first test case first). The highlighted arrow symbol means an ending newline was expected but is missing from your program's output.
Matching output exactly, even whitespace, is often required. Change the program to output an ending newline.
Click on "Develop mode", and change the output statement to output a newline: cout << userNumSquared << endl;. Type 2 in the input box and run.
Click on "Submit mode", click "Submit for grading", and observe that now the first test case passes and 1 point was earned.
The last two test cases failed, due to a bug, yielding only 1 of 3 possible points. Fix that bug.
Click on "Develop mode", change the program to use * rather than +, and try running with input 2 (output is 4) and 3 (output is now 9, not 6 as before).
Click on "Submit mode" again, and click "Submit for grading". Observe that all test cases are passed, and you've earned 3 of 3 points.
Answer:
Change line 10 to:
userNumSquared = userNum * userNum;
Change line 11 to:
cout << userNumSquared<<endl;
Explanation:
Though the question is a bit lengthy but the requirements are not clearly stated. However, I'm able to pick up the following points.
Print the square of the inputted numberPrint the squared number with a new lineTo do this, we simply modify the affected lines which are lines 10 and 11.
The plus sign on line 10 will be modified to multiplication
i.e.
userNumSquared = userNum * userNum;
And line 11 will be modified to:
cout << userNumSquared<<endl;
Every other line of the program is okay and do not need to be modified
A Zookeeper wants you to create a program to keep track of all of the animals in the zoo and people working for him. You are given 4 files: Mammals.txt, Birds.txt, Reptiles.txt, and Personnel.txt. Your task is to create an array of structs for each file to hold the entries. The first line of each file will be a number indicating how many entries are in the file.
Answer:
I don't know you should figure that out good luck
Explanation:
good luck
Explain the complement of a number along with the complements of the binary and decimal number systems.why is the complement method important for a computer system?
olha so olha la que bacana bonito
The complement method are the digital circuits, are the subtracting and the addition was the faster in the method. The binary system was the based on the bits are the computer language.
What is computer?
Computer is the name for the electrical device. In 1822, Charles Babbage created the first computer. The work of input, processing, and output was completed by the computer. Hardware and software both run on a computer. The information is input into the computer, which subsequently generates results.
The term “binary” refers to the smallest and minimum two-digit number stored on a computer device. The smallest binary codes are zero (0) and one (1). The use of storing numbers easily. The computer only understands the binary language. The binary is converted into the number system as a human language. The complement method are the digital circuits the addition and the subtracting was the easily.
As a result, the complement method is the digital circuits are the subtracting to the binary system was the based on the bits are the computer language.
Learn more about on computer, here:
https://brainly.com/question/21080395
#SPJ2
Binary is a base-2 number system instead of the decimal (base-10) system we are familiar with. Write a recursive function PrintInBinary(int num) that prints the binary representation for a given integer. For example, calling PrintInBinary(5) would print 101. Your function may assume the integer parameter is non-negative. The recursive insight for this problem is to realize you can identify the least significant binary digit by using the modulus operator with value 2. For example, given the integer 35, mod by 2 tells you that the last binary digit must be 1 (i.e. this number is odd), and division by 2 gives you the remaining portion of the integer (17). What 's the right way to handle the remaining portion
Answer:
In C++:
int PrintInBinary(int num){
if (num == 0)
return 0;
else
return (num % 2 + 10 * PrintInBinary(num / 2));
}
Explanation:
This defines the PrintInBinary function
int PrintInBinary(int num){
This returns 0 is num is 0 or num has been reduced to 0
if (num == 0)
return 0;
If otherwise, see below for further explanation
else
return (num % 2 + 10 * PrintInBinary(num / 2));
}
----------------------------------------------------------------------------------------
num % 2 + 10 * PrintInBinary(num / 2)
The above can be split into:
num % 2 and + 10 * PrintInBinary(num / 2)
Assume num is 35.
num % 2 = 1
10 * PrintInBinary(num / 2) => 10 * PrintInBinary(17)
17 will be passed to the function (recursively).
This process will continue until num is 0
An equal-tangent sag equal tangent vertical curve is designed for 45 mi/h. The low point is 237 ft from the PVC at station 112 + 37 and the final offset at the PVT is 19.355 ft. If the PVC is at station 110 + 00, what is the elevation difference between the PVT and a point on the curve at station 111 + 00?
Answer:
vertical and I have a great day of school
which among the following if absent, a computer is not complete.
A. mouse
B. DVD
C. user
D. projector
Answer:
user because all the other things the computer need
You should write the client so that it sends 10 ping requests to the server, separated by approximately one second. Each message contains a payload of data that includes the keyword PING, a sequence number, and a timestamp. After sending each packet, the client waits up to one second to receive a reply. If one second goes by without a reply from the server, then the client assumes that its packet or the server's reply packet has been lost in the network.Hint: Cut and paste PingServer, rename the code PingClient, and then modify the code. The two programs follow very similar process.You should write the client so that it starts with the following command:java PingClient host portwhere host is the name of the computer the server is running on and port is the port number it is listening to. Note that you can run the client and server either on different machines or on the same machine.The client should send 10 pings to the server. Because UDP is an unreliable protocol, some of the packets sent to the server may be lost, or some of the packets sent from server to client may be lost. For this reason, the client cannot wait indefinitely for a reply to a ping message. You should have the client wait up to one second for a reply; if no reply is received, then the client should assume that the packet was lost during transmission across the network. You will need to research the API for DatagramSocket to find out how to set the timeout value on a datagram socket.When developing your code, you should run the ping server on your machine, and test your client by sending packets to localhost (or, 127.0.0.1). After you have fully debugged your code, you should see how your application communicates across the network with a ping server run by another member of the class.Message FormatThe ping messages in this lab are formatted in a simple way. Each message contains a sequence of characters terminated by a carriage return character (r) and a line feed character (n). The message contains the following string:PING sequence_number time CRLFwhere sequence_number starts at 0 and progresses to 9 for each successive ping message sent by the client, time is the time when the client sent the message, and CRLF represent the carriage return and line feed characters that terminate the line.
Answer:
figure it out urself
Explanation:
what are the cleaning solutions used in cleaning gas stove, refrigerator and kitchen premises?
Answer:
Detergents. Soaps, liquid or paste. Solvent cleaners. Acid cleaners. Abrasive cleaners. Applying heat. Exposing to radiant energy. Chemical sanitizers. Natural cleaning materials.
Explanation:
identify similarities and differences of hibiscus leaves
Answer:
I'm sorry but I cant answer if it's only one product,it should be two..it's like different to what,or similar to what
Write a python program that gets a number using keyboard input. If the number is positive, the program should call countdown
Answer:
def countdown():
print("This is countdown")
number = int(input("Enter number: "))
if (number > 0):
countdown()
Explanation:
This is literally what you asked, but what is the purpose?
How is QA done in agile projects
200+300-500.
Explanation:
rjfnvkfjfhfofgfohgighghgiggh
If columns are labelled alphabetically, what will be the label for the cell in row 1, column 16,384?
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Hope this helps!
Hello! So I have been practising some coding, however, there seems to be an error in my code. I have been trying to figure out what is wrong, however, I just can't seem to find it. There is no syntax error but, there seems to be a problem with my input. I am currently using repl.it and I am making a calculator. I would input something like "multiply" however, the calculator would only square. I have tried changing the variables but it just keeps coming back to the first "if" statement. I would appreciate some help.
Answer:
You OR expressions are wrong.
Explanation:
Rather than writing:
if method == "Square" or "square":
You should write:
if method == "Square" or method == "square":
The expression should evaluate to something that is true or false.
In the above case, the expression is method == "Square" or method == "square" which can are actually two sub-expressions with an or in between them:
subexpr1 or subexpr2
each of the sub-expressions should evaluate to true or false.
method == "Square" is one of those sub-expressions.
That is how an expression is broken down by the compiler.
TIP: If you would add method = method.lower() right after the input, you could simplify all the if statements by removing the uppercase variants.
who is the father of computer?
1.Charles Babbage 2.James Waat
Answer:
its 1 Charles babbage
Explanation:
shjdjdjdjdjdj
Answer:
Si Charles Babbage,
Explanation:
FRS ay isang Ingles na matematiko, pilosopo, imbentor, at inhinyerong mekanikal na nagpanimula ng konsepto ng isang naipoprogramang kompyuter. Nakatanghal ang mga bahagi ng kanyang hindi pa buong mga mekanismo sa Museo ng Agham sa London.
8.15 lab*: Program: Playlist
Answer:
8.15 LAB* Program: Playlist You Will Be Building A Linked List. Make Sure To Keep Track Of Both The Head And Tail Nodes. (1) Create Three Files To Submit • PlaylistNode. h - Struct Definition And Related Function Declarations • PlaylistNode.
You are asked to write a program that prompts the user for the size of two integer arrays, user input for the size must not exceed 50, you must validate this. We will use these arrays to represent our sets. These arrays will be randomly populated in the range that is 1 through double the size of the array. So if the array is of size 20, you will randomly populate it with values in the range 1-40 inclusive.
Answer:
In Java:
import java.util.*;
public class MyClass{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Length of array 1: ");
int lent1 = input.nextInt();
while(lent1 <= 0 || lent1 > 50){
System.out.print("Length of array 1: ");
lent1 = input.nextInt();
}
int[] array1 = new int[lent1];
System.out.print("Length of array 2: ");
int lent2 = input.nextInt();
while(lent2 <= 0 || lent2 > 50){
System.out.print("Length of array 2: ");
lent2 = input.nextInt();
}
int[] array2 = new int[lent2];
for(int i =0;i<lent1;i++){
array1[i] = (int)(Math.random() * (lent1*2) + 1);
}
for(int i =0;i<lent2;i++){
array2[i] = (int)(Math.random() * (lent2*2) + 1);
}
System.out.print("Array 1: ");
for(int i =0;i<lent1;i++){
System.out.print(array1[i]+" ");
}
System.out.println("Array 2: ");
for(int i =0;i<lent2;i++){
System.out.print(array2[i]+" ");
}
}
}
Explanation:
This prompts the user for length of the first array
System.out.print("Length of array 1: ");
This declares and gets input for the length of the first array
int lent1 = input.nextInt();
This validates the length of first array
while(lent1 <= 0 || lent1 > 50){
System.out.print("Length of array 1: ");
lent1 = input.nextInt(); }
This declares the first array
int[] array1 = new int[lent1];
This prompts the user for length of the second array
System.out.print("Length of array 2: ");
This declares and gets input for the length of the second array
int lent2 = input.nextInt();
This validates the length of the second array
while(lent2 <= 0 || lent2 > 50){
System.out.print("Length of array 2: ");
lent2 = input.nextInt(); }
This declares the second array
int[] array2 = new int[lent2];
The following generates random integers between 1 and lent1*2 to array 1
for(int i =0;i<lent1;i++){
array1[i] = (int)(Math.random() * (lent1*2) + 1); }
The following generates random integers between 1 and lent2*2 to array 2
for(int i =0;i<lent2;i++){
array2[i] = (int)(Math.random() * (lent2*2) + 1); }
This prints the header Array 1
System.out.print("Array 1: ");
The following iteration prints the content of the first array
for(int i =0;i<lent1;i++){
System.out.print(array1[i]+" ");
}
This prints the header Array 2
System.out.println("Array 2: ");
The following iteration prints the content of the second array
for(int i =0;i<lent2;i++){
System.out.print(array2[i]+" ");
}
You are given the following segment of code:Line 1: PROCEDURE printScorePairs()Line 2: {Line 3: count <-- 0Line 4: sum <-- 0Line 5: i <-- 1Line 6: scores <-- [73, 85, 100, 90, 64, 55]Line 7: REPEAT UNTIL ( i > LENGTH (scores) )Line 8: {Line 9: sum <-- scores[i] scores[i 1]Line 10: DISPLAY ( sum )Line 11: i <-- i 2Line 12: }Line 13: }The ABC company is thrifty when it comes to purchasing memory (also known as RAM) for its computers. Therefore, memory is of the utmost importance and all programming code needs to be optimized to use the least amount of memory possible. What modifications could be made to reduce the memory requirements without changing the overall functionality of the code?
Answer:
Move Line 10 to after line 12
Explanation:
Required: Modify the program
From the procedure above, the procedure prints the sum at each loop. Unless it is really necessary, or it is needed to test the program, it is not a good practice.
To optimize the program, simply remove the line at displays the sum (i.e. line 10) and place it at the end of the loop.
So, the end of the procedure looks like:
Line 10: i <-- i 2
Line 11: }
Line 12: DISPLAY ( sum )
Line 13:
Write a SELECT statement that returns one row for each customer that has orders with these columns: The email_address from the Customers table
A count of the number of orders
The total amount for each order
(Hint: First, subtract the discount amount from the price. Then, multiply by the quantity.) Return only those rows where the customer has more than 1 order. Sort the result set in descending sequence by the total amount . Hint: You will join three tables together. Returns 3rows of data.
Questions done up until #4: https://pastebin.com/LwSKknPi
all questions before and after:
Write a SELECT statement that returns these columns:
The count of the number of orders in the Orders table
The sum of the tax_amount columns in the Orders table
Returns 1 row of data.
Write a SELECT statement that returns one row for each category that has products with these columns:
The category_name column from the Categories table
The count of the products in the Products table
The list price of the most expensive product in the Products table
Sort the result set so the category with the most products appears first.
Hint: You will join two tables together. Returns 3 rows of data.
Write a SELECT statement that returns one row for each customer that has orders with these columns:
The email_address column from the Customers table
The sum of the item price in the Order_Items table multiplied by the quantity in the Order_Items table
The sum of the discount amount column in the Order_Items table multiplied by the quantity in the Order_Items table
Sort the result set in descending sequence by the item price total for each customer.
Hint: You will join three tables together. Returns 7 rows of data.
Modify the solution to exercise 4 so it only counts and totals line items that have an item_price value that’s greater than 400. Returns 2 rows of data.
Write a SELECT statement that answers this question: What is the total amount ordered for each product? Return these columns:
The product name from the Products table
The total amount for each product in the Order_Items (Hint: You can calculate the total amount by subtracting the discount amount from the item price and then multiplying it by the quantity)
Use the WITH ROLLUP operator to include a row that gives the grand total.
Hint: You will join two tables together. Returns 10 rows of data.
Write a SELECT statement that answers this question: Which customers have ordered more than one product? Return these columns:
The email address from the Customers table
The count of distinct products from the customer’s orders
Hint: You will join three tables together. . Returns 3 rows of
Answer:
Please find the attachment files of the queries:
Explanation:
In the all queries the select statement is used that selects the defined columns and use the function like sum, join, orderby, and groupby to perform the various operations, in which the sum is used to add columns or rows values, join is used for joining two or more tables, and orderby is used for return the table into ascending or descending order, and groupby is used for the count the value, calculate average and perform other operation and gives its return value.
Have you ever tried using such a camera?
Answer: yeah i mean i use my canon camera
Explanation:
The math club starts with 5 members. Five months later, their membership has grown to 50 members.
What was the average number of members who joined the math club per month?
Explanation:
10 members per month i think
Answer:
10 members per month
Explanation:
brainliest pls its right i think
have a good day :D
What does the abbreviation JPEG stand for?
A. Japanese Photographic Examination Group
B. Joint Photo Examination Group
C. Joint Photographic Expert Group
D. Jefferson Photo Exclusive Group
E. Jacket Photo Extension Group
Answer:
c) giant photographic experts group
Answer:
C
Explanation:
(often seen with its file extension stands for
"Joint Photographic Experts Group",
What is Open Source Software
Answer:
Open-source software is a type of computer software in which source code is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software to anyone and for any purpose
Explanation:
2. It is the art of creating computer graphics or images in art, print media, video games.
ins, televisions programs and commercials.
Select the correct answer.
The idea that different aspects of health influence each other is known as _____ .
A.
Holistic health
B.
Happy health
C.
Integral health
D.
Perfect health
Answer:
A. Holistic health
Explanation:
Holistic health refers to the method of caring the entire body. It includes physical, mental and emotional health of the individual. The overall health of an individual depends on the fitness of al these aspects of the body. The mind, body and the soul are considered to be interdependent and therefore the fitness of the body depends on the fitness of all of these parts.
Answer:
A
Explanation:
The definition of holistic is relating to the idea that things should be studied as a whole and not just as a sum of their parts. An example of holistic is health care that focuses on the health of the entire body and mind and not just parts of the body.
h. What is recycle bin?
->
Answer:
Trash application, the Recycle Bin
What is computer science
Answer:
computer science is the study of computer and computing as well as theoretical and practical applications.
pls give me thanks ☺️☺️
How to write an algorithm to read and print a name?
I want the steps please
Answer:
Step 1: Obtain a description of the problem. This step is much more difficult than it appears. ...
Step 2: Analyze the problem. ...
Step 3: Develop a high-level algorithm. ...
Step 4: Refine the algorithm by adding more detail. ...
Step 5: Review the algorithm.
Explanation:
When you
you can use the diverse knowledge sets of a team and share a workload.
O strategize
O quantify
discriminate
I
O collaborate
Answer:
Collaborate.
Explanation:
It was correct for me!
Answer:collaborate
Explanation:
cs edgen 100%
What is Software Packages
[tex]{\fcolorbox{red}{black}{\white {Answer}}}[/tex]
A software package is an assemblage of files and information about those files. ... Each package includes an archive of files and information about the software, such as its name, the specific version and a description. A package management system (PMS), such as rpm or YUM, automates the installation process.
5. The operating system has two components
a. Software and Hardware
c. Shell and Kernel
b. Sof
d. File