Consider the following program in which the statements are in the incorrect order. Rearrange the statements in the following order so that the program prompts the user to input: 1. The height of the base of a cylinder 2. The radius of the base of a cylinder The program hen outputs (in order): 1. The volume of the cylinder. 2. The surface area of the cylinder Format the output to two decimal places. #include #include int nain() double hetght; cout « "Volune of the cylinder =
Q: The following table lists the freezing and boiling points of several substances. Substance…
A: Given The answer is given below.
Q: A half-life is the amount of time it takes for a substance or entity to fall to half its original…
A: Start Input caffeineMg yourValue <- caffeineMg yourValue <- yourValue/2 print After 6 hours…
Q: TASK 3: Write a program that accepts the input code from the user and print according to the input…
A: in c: #include <stdio.h>int main(){ int n1; printf("enter the number: ");…
Q: B// List the error (if it found) for the following program ,then correct them, rewrite the program…
A: Need to find out error in the given code Program is written to calculate value of y, where a and b…
Q: The power of the microwave can be calculated as follows: Power=Work/Time Work is measured in joules…
A: code: #include<iostream> using namespace std; //main method int main() { //variable…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats)…
A:
Q: Suppose you have a certain amount of money in a savings account that earns compound monthly…
A: Inorder to give user the option if he wants to use the service again I have used while loop logic at…
Q: The statements in the following program are in incorrect order. Rearrange the statements so that…
A: To re-arrange the code, so that the code compiles, prompts, dimensions of rectangle, circle,…
Q: Find the Logical or Syntax Errors in the following program Q1: int main() { cin>> x;…
A: In computer programming, there are two types of errors such as: Logical error: It is difficult to…
Q: The following equation estimates the average calories burned for a person when exercising, which is…
A: Algorithm: Start Read Age,Weight, HeartRate, Time Calculate Calories = ((Age x 0.2757) + (Weight x…
Q: a) Write a program that begins by reading a radius, r from the user. The program will continue by…
A: TO FIND AREA AND VOLUME OF THE CIRCLE
Q: Following is an example of different ways one can declare variables for some programming language.…
A: following are the possible Regular expressions :
Q: 1. Create a program that asks for a distance in kilometers and converts it into its metric…
A: /*C program to ask distance in kilometers and converts it into its meter equivalent*/ #include…
Q: The following is related to a Java Code: The following if statement determines whether choice is…
A: Answer: given condition is : if (choice == 'Y' || choice == 'y') inorder to make only one comparison…
Q: Write a program that computes the cost of painting and installing carpet in a room. Assume that the…
A: In this question, we will create a class ROOM to store the properties of the room and to calculate…
Q: (a) Write a program that begins by reading a radius, r from the user. The program will continue by…
A: Write a program to find the area of the circle and the volume of the sphere. area of the circle is…
Q: Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output…
A: import java.util.*;class Test89 { public static void main(String args[]) { Scanner sc = new…
Q: Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output…
A: import java.util.*;public class LabProgram { public static void main(String args[]) { Scanner sc =…
Q: Write a program that reads two numbers from the keyboard representing, respectively, an investment…
A: the answer is given below:-
Q: The homework is to re-write the previous program so that the user does not need to enter any…
A: The homework is to re-write the previous program so that the user does not need to enter any…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats)…
A: ****************** Maths used to calculate the total cost ***************** miles/per states that…
Q: Task: Write the full program that has the following main function. Your program should ask the user…
A: Given: Program to find area or perimeter of the rectangle.
Q: can you help with the codes to the following question? the programming langauge is Java. (Financial…
A: Here fees is incremented by 5% compounded. i.e after first year fee become $10,500 and for next year…
Q: Write a code using C++ for the given prompt: A contractor orders, say, 30 cubic yards of premixed…
A: #include <cmath> #include <iostream> using namespace std; int main() { double…
Q: Output the classic (albeit slightly modified) drinking song. 99 bottles of Pepsi on the wall, 99…
A: Given: Output the classic (albeit slightly modified) drinking song. 99 bottles of Pepsi on the wall,…
Q: Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output…
A: mileage = float(input("Enter miles/gallon: "))rate = float(input("Enter dollars/gallon: "))…
Q: a. What is the output of executing the following Java statements: {5 int x = 10, y = 20; boolean bl…
A: The output for the program is given below Output - The value of b3 is false The value of b4 is…
Q: The statements in the following program are in incorrect order. Rearrange the statements so that…
A: code: #include <iostream> #include <cmath> #include <iomanip> #include…
Q: 3. Write a program that checks the screen time of a child and repeats, this procedure three times.…
A: #include<stdio.h>int main(){ int age; float screen_time; for(int i=0;i<3;i++){…
Q: A company selling household appliances gives commissions to its salesman determined by the kind of…
A: import java.util.*; class GFG { public static void main (String[] args) { Scanner sc= new…
Q: You are given the code below. It's a game where the user has to guess a sequence of four 1-digit…
A: Since there are multiple sub parts in this post, as per our policy I'll answer the first three…
Q: In the below given program there is an error, find the error and write the correct statement.
A: In assignment statement num2 variable is not passed, hence it will return syntax error, num not…
Q: Enter the year in two epochs, determine the leap year during this period, and print ten years each…
A: import java.util.Scanner; public class Main{ public static void printLeapYear(int year1, int…
Q: A contractor orders, say, 30 cubic yards of premixed concrete toconstruct a patio that is to be,…
A: Code : #include <iostream> #include <cmath> using namespace std; int main() {…
Q: Assume that at some stage, foo(80, 100) is called. The function, in turn, called by foo(80, 100) is…
A: given code- public static int foo(int a, int b) { if(b == 0) return a; return foo(b, a%b);}…
Q: If you run the following program, in which order the statements of this program will be executed?…
A: Here in this question we have given a python code and we have asked the sequence followed when we…
Q: Write a program that reads from the user a character ('q' or 'c'). if the character is 'c', the…
A: Java Program for above : import java.util.Scanner; class Prog{ public static void main…
Q: Create a new version of the program below that uses Boolean expressions (not true of false) for…
A: A boolean expression is an expression that yields just the two outcomes: true or false. To relate…
Q: Write a program with total change amount as an integer input, and output the change using the fewest…
A: According to the question below the Solution: Output:
Q: Write a program that reads the following information and prints payroll statements. These are the…
A: <?php //getting full name from user $fullname = readline('Enter fullname : ');…
Q: Consider the following program in which the statements are in the incorrect order. Rearrange the…
A: #include<iostream> #include<iomanip> #include<cmath> using namespace std; int…
Q: Write a program that allows the user to specify the number of iterations used in this approximation…
A: # if you want value of pi then you need to multiply by 4 in given equation# because the relation is…
Q: A contractor orders, say, 30 cubic yards of premixed concrete to construct a patio that is to be,…
A: Find the required code given as below and sample output :
Q: Correct the syntax errors in the following program, and rewrite the program so that it follows our…
A: The operator(=) is called the assignment operator that is used to assign the right side operand…
Q: Create a program and inside your program, type the code as given below. Then rewrite the nested ifs…
A: Hey, since there are multiple questions posted, we will answer first question. If you want any…
Q: 2) If last digit of your id is 0,1,2,3,4 then answer (a), if last digit of your id is 5,6,7,8,9 then…
A: PROGRAM EXPLANATION: Import java.util package. Create the main class. Define a method check, this…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both…
A: #program to find cost for 20,75,500 miles for given miles/galon and gas dollars/gallon#reading…
Q: the electrical resistance r (in ohms) of a metal wire is given by the formula r = (ml)/ a where m is…
A: As no programming language is mentioned it is solved using basic C++
Q: A contractor orders, say, 30 cubic yards of premixed concrete to construct a patio that is to be,…
A: Given The answer is given below.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- Consider the following program in which the statements are in the incorrect order. Rearrange the statements in the following order so that the program prompts the user to input: The height of the base of a cylinder The radius of the base of a cylinder The program then outputs (in order): The volume of the cylinder. The surface area of the cylinder Format the output to two decimal places. #include <iomanip> #include <cmath> int main() {} double height; cout << "Volume of the cylinder = " << PI * pow(radius, 2.0) * height << endl; cout << "Enter the height of the cylinder: "; cin >> radius; cout << endl; return 0; double radius; cout << "Surface area: " << 2 * PI * radius * height + 2 * PI * pow(radius, 2.0) << endl; cout << fixed << showpoint << setprecision(2); cout << "Enter the radius of the base of the cylinder: "; cin >> height; cout << endl; #include <iostream> const…The statements in the following program are in incorrect order. Rearrange the statements so that they prompt the user to input the shape type (rectangle, circle, or cylinder) and the appropriate dimension of the shape. The program then outputs the following information about the shape: For a rectangle, it outputs the area and perimeter; for a circle, it outputs the area and circumference; and for a cylinder, it outputs the volume and surface area. After rearranging the statements, your program should be properly indented.. The statements in the following program are in incorrect order. Rearrange the statements so that they prompt the user to input the shape type (rectangle, circle, or cylinder) and the appropriate dimension of the shape. The program then outputs the following information about the shape: For a rectangle, it outputs the area and perimeter; for a circle, it outputs the area and circumference; and for a cylinder, it outputs the volume and surface area. After rearranging the statements, you program should be properly indented. using namespace std; #include int main () string shape; double height; #include > shape; cout << endl; if (shape = "rectangl e") cout << "Area of the circle - " << PI* pow (radius, 2.0) << endl; cout < "Circumference of the circle : << 2 * PIpow (radius, 2.0) << endl; cout < "Enter the height of the cylinder: " cin >> height cout < endl; cout < "Enter the width of the rectangle : " cin >> width; cout…
- C++ Programming Exercise: A real estate office handles, say, 50 apartment units. When the rent is, say, $600 per month, all the units are occupied. However, for each, say, $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance. How many units should be rented to maximize the profit? Write a program that prompts the user to enter: a. The total number of of units. b. The rent to occupy all the units. c. The increase in rent that results in a vacant unit. d. Amount to maintain a rented unit. The program then outputs the number of units to be rented to maximize the profit.Write a program that performs as a very simple calculator. Your calculator should be able to handle the four basic math operations — add, subtract, multiply, and divide — on two input values. Your program should prompt the user to enter three arguments: two double values and a character to represent an operation. If the entry arguments are 35.6, 24.1, and '+', the program output should be The sum of 35.6 and 24.1 is 59.7.the electrical resistance r (in ohms) of a metal wire is given by the formula r = (ml)/ a where m is the resistivity of the metal; l is the lenght of the wire in feer, and a is the cross-sectional area of the wire ( in the circular mils) write a program that allow user to input for l and a for a copper whose resistivity m of copper is 10.4. Calculte the resistance of a wire
- A contractor orders, say, 30 cubic yards of premixed concrete toconstruct a patio that is to be, say, four inches thick. The length ofthe patio is to be, say, twice the width. Write a program that promptsthe user to specify the amount of premixed concrete (in cubic yards)ordered, the thickness of the patio (in inches), and the ratio of lengthand width. The program then outputs the length and width of thepatio (in feet). (1 cubic yard = 27 cubic feet.) (To find the squareroot of a decimal number, include the header filecmathusing thestatement#include, in your program. The functionsqrt, includedin this header file, determines the square root of a decimal number.For example,sqrt(16.0) = 4.0.)An oil slick occurs when an underwater refinery pipe ruptures, pumping oil into the water. The spilled oil sits on top of the water and causes a natural disaster. For simplicity, suppose that the oil sits on top of the water in the form of a circle. Write a program that prompts the user to enter the rate at which the ruptured pipe pumps oil (in gallons) per minute, the thickness of the oil on top of the water, and the number of days for which the area is covered by the spilled oil. The program outputs the spilled area (in kilometer) and the volume of oil (in gallons) on top of the water after each day.TASK 3: Write a program that accepts the input code from the user and print according to the input code. If the user enters a number 1, then he would go to heaven. If he inputs 2, then the hell was created within his mind and if he prints any other number then his mother earth is waiting for him. Use nested if-else statements.
- 4. During each summer, John and Jessica grow vegetables in their backyard and buy seeds and fertilizer from a local nursery. The nursery carries different types of vegetable fertilizers in various bag sizes. When buying a particular fertilizer, they want to know the price of the fertilizer per pound and the cost of fertilizing per square foot. The following program prompts the user to enter the size of the fertilizer bag, in pounds, the cost of the bag, and the area, in square feet, that can be covered by the bag. The program should output the desired result. However, the program contains logic errors. Find and correct the logic errors so that the program works properly. // Logic errors. #include #include using namespace std; int main() { double costs double area; double bagsize; cout > bagsize; cout > cost; cout > area; cout << endl; cout << "The cost of the fertilizer per pound is: $" << bagsize / cost << endl; cout << "The cost of fertilizing per square foot is: $" << area / cost << endl; return 0; }Consider the following statements: Which of the following statements are valid? If they are invalid, explain why. (4) a. volume = box (length, width, height); b. volume = box (length, 3.8, height); c. cout << box(num1, num3, num2) << endl; d. cout << box (length, width, 7.0) << endl; e. volume = box (length, num1, height); f. cout << box(6.2, , height) << endl; g. volume = box (length + width, height) h. volume = box (num1, num2 + num3) ;(Statistics) This is the formula for the standard normal deviate, z, used in statistical applications: z=(X)/ X is a single value. refers to an average value. refers to a standard deviation. Using this formula, you need to write a program that calculates and displays the value of the standard normal deviate when X=85.3,=80,and=4. a. For this programming problem, how many outputs are required? b. How many inputs does this problem have? c. Determine a formula for converting input items into output items. d. Test the formula written for Exercise 7c, using the data given in the problem.