a) Write a program that begins by reading a radius, r from the user. The program will continue by computing and displaying the area of a circle with r and the volume of a sphere with radius r. Declare pi as a constant in your calculations. Hint: The area of a circle is compound using the formula: area xr. The volume of a sphere is computed using the formula: vlume 4/3ar".
Q: Q3: The volume of a circular cylinder V=rtr?h, write a program to compute the volume if r=8m and…
A: Objective: This program designs a class to create cylinders for a given height and radius. The…
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: d. Given that an int variable s has been initialized, write a statement(s) that declares a new…
A: d) int s1=(9*(s-8))%4
Q: (B)The following is a list of 20 exam scores. Write a computer program to calculates the average…
A: Python Program:- n=int(input("Enter the number of elements to be inserted: "))a=[]for i in…
Q: I'm stuck on this problem, and here's what I'm stumped on: Meadowdale Dairy Farm sells organic brown…
A: The Answer is
Q: Q1. Write a program that takes a range from the user and display all the even numbers between the…
A: /* C++ program to print the even numbers within the given range */ #include…
Q: A- Given the declaration: int main () int x; int p; int q; return 0; mark the following statements…
A: Answer: Valid Invalid Valid Valid Invalid
Q: Question: Write A Program That Compares The Values Of Y1 And Y2 In.. 3. ( Write a program that…
A: Given:
Q: Develop a program that begins by reading a few seconds from the user. Then your program should…
A: CODE second=int(input("enter the number of second ")) days=0 hour=0 minutes=0 day=24*60*60…
Q: “Fix” the following 3 lines of code so that the print the last line of code correctly: age…
A: EXPLANATION: In the first line, there should be “=” to assign the value and to get the int type…
Q: Q3: Write a VB program to enter a mark of a student and then find his grade as follows: If mark >=75…
A: VB program is asked with the following conditions: If mark>=75 print Grade = A If…
Q: (b) Given a and b are int variables and c is a double variable. The initial value for a, b, and c…
A: Postfix Operator: value of the variable is first used the expression and its incremented by 1. Since…
Q: Q2: complete the function that returns the area of a circle with radius r, note, use math.pi for pi.…
A: Given: To complete the python code.
Q: 3. Write a program that displays the following pattern: ***** *** * *** *****
A: As no programming language is mentioned, it is solved using basic C++
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: Q2: complete the function that returns the area of a circle with radius r, note, use math.pi for pi.…
A: Python code for above : import math def circle_area(r): # calculate rae area = math.pi…
Q: Q2)- Choose the correct statement 1- To change the text x to capital letters, use the function : a)…
A: Lcase is a function in Visual Basic is used to convert a string to lower case Ucase is a function in…
Q: #include int main() { float a =3e-1,b=2e-2; printf("a=%f b=%f",a,b); return 0; } note : what is e…
A: e work as scientific notation for example. Significand Exponent Scientic notation float/fixed…
Q: Activity #2: Write a program that computes parking fees for a garage with the fee structure given in…
A: Objective: This program reads the number of hours parked for vehicles and computes the total charge.…
Q: Write the Python program that finds the total fuel cost of the vehicle according to the amount of…
A: Python Program a = float(input("Fuel consumption per km (lt) "))b = float(input("Price of 1 liter of…
Q: you have the following statements: int a=2, b=3, c=43; double z=4.5, w=6.7; const float f=8.9%3; The…
A: Answer :
Q: 9) Write a program that takes in the user's name and age. Then displays his/her name's initial…
A: #include<iostream> using namespace std; int main() // main function { string name,…
Q: second. 2. Write a program that converts feet to meters. The program should display feet from 3 to…
A: PROGRAM CODE: #include <stdio.h> int main(void){ int start = 3, end = 30;…
Q: b- Write a program that allows the user to enter coordinates of circle center and radius then asks…
A: Given: Write a program that allows the user to enter coordinates of circle center and radius then…
Q: You are required to write a program to compute the area of square (area = side) OR a triangle (area…
A: Required:
Q: 1. Write a program that converts miles to feet. If the distance is more than 15,000 feet, tell the…
A: C program to solve the given problem is below.
Q: 4. Write a simple program that checks the coordinates of a point taken from a user and identifies…
A: Code: //include the required headers #include<iostream> using namespace std; //main method…
Q: 8. Write a program that will compute delivery charges based on weight Weight Up to 100 lb Charge per…
A: A program is as follows, Code: %Get the input from the user weight=input('Please enter weight of…
Q: (d) int vara; char *ptrvar; ptrvar = vara; (e) Assume int b[ 20 ] = { 0 }, k; for ( k = 0; k <= 20;…
A: (d).
Q: 2.12 LAB: Driving costs Driving is expensive. Write a program with a car's gas mileage…
A: Code: def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon): return (driven_miles…
Q: 4. Write a simple program that checks the coordinates of a point taken from a user and identifies…
A: code: //include the required headers #include<iostream> using namespace std; //main method…
Q: 1. Get three exam grades from the user and compute the average of the grades. Ou average of the…
A: ALGORITHM Start Declare 3 variables- (grade1, grade2 and grade3) of float type Declare another…
Q: (Diameter, Circumference and Area of a Circle) Write a program that reads in the radiusof a circle…
A: #include <stdio.h> int main() { float r; printf("enter radius :- "); scanf("%f",&r);…
Q: 2.13 LAB: Driving costs Driving is expensive. Write a program with a car's miles/gallon and gas…
A: According to the question below the solution: Output:
Q: C++ Exercise 30 defines the number e and Exercise 31 shows how to approximate the value of e using…
A: #include <iostream> using namespace std; float cal(int i, int n) { if(i == n) return ((i-1) +…
Q: Point out the errors if any in the following part of the program in c++ void main() { int…
A: void main() { int a=30; f(); // function call } void f() //function definition { int b=10;…
Q: 2. Create a program that will display the area of the following using functions: a. triangle b.…
A: #include<iostream>using namespace std;//function prototypefloat getSquarearea(float…
Q: Write a program with total change amount as an integer input, and output the change using the fewest…
A: CODE:- amount = int(input("Enter Amount: "))if amount<=0: print("No Change") else:…
Q: 2.3 Write a Java program that randomly generates three integer numbers between 0-150. Then,…
A: import java.util.*;public class Main{ public static void main(String[] args) { Random rand= new…
Q: 3. Write a program that computes and interprets the Body Mass Index (BMI). The program prompts the…
A: Prompt to enter the weight in pounds. Store the value in a variable. Prompt to enter the height in…
Q: Assuming x (type double) is 12.335 and i (type int) is 100, show the lines displayed by the…
A: Find Your Answer below
Q: 2. Write a program that computes the cost of painting and installing carpet in a room. Assume that…
A: Actually, program is a executable software that runs on a computer.
Q: 3.13 LAB: Exact change Write a program with total change amount as an integer input, and output the…
A: coded in python to get the above output of exact changes (Python Language)
Q: Suppose x, y, and z are int variables and x = 18, y = 5, and z = 4. What is the output of each of…
A: Given, cout << "x = " << x << ", y = " << y << ", z = " << z…
Q: Q5: Write in Python program: After calculating the ranking score according to the ALES (Academic…
A: ales = float(input("Enter ALES score: "))lang = float(input("Enter the foreign language score:…
Q: (Display a pattern) Write a program that displays the following pattern:JJ aaa v vaaaJ J aa v v a aJ…
A: File name: "Solution.java" public class Solution { public static void main(String[] args)…
Q: E2.7 Write a program that prompts the user for a radius and then prints • The area and circumference…
A: We are going to take radius as input from the user and then we will find out area of the circle,…
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- 7) The ideal gas law allows the calculation of volume of a gas given the pressure(P), amount ofthe gas (n), and the temperature (T). The equation is:V = nRT / PSince we only have used integer arithmetic, all numbers will be integer values with nodecimal points. The constant R is 8.314 and will be specified as (8314/1000). This givesthe same result. Implement the idea gas law program where the user is prompted for andenters values for n, T, and P, and V is calculated and printed out. Be careful toimplement an accurate version of this program. Your program should include a properand useful prompt for input, and print the results in a meaningful mannerQ3: The volume of a circular cylinder V=Ttr?h, write a program to compute the volume if r=8m and h=15m and then create another cylinder have a size larger than the first by 20%, but having the same height as the first, how much the radius should beNeed help coding in Java Morgan’s Department Store distributes bonuses to its salespeople after the holiday rush. Table 9-6 shows the bonuses, which are based on full weeks worked during the season and the number of positive online customer reviews. Write a program that allows a user to continuously enter values for the number of weeks worked and the number of positive reviews received and displays the appropriate bonus until the user enter a sentinel value: 99.
- . Task 3: Find the numbers that can be expressed as the product of two nonnegative integers in succession and print them in increasing order. (For example, 30 is such a number as it can be written as the product of 5 and 6 (30=5x6), which are two numbers in succession.) The user should specify a maximum value and the program should print all said numbers smaller than or equal to that value. The program should keep a count of how many numbers were printed and should output that count ,as well as the numbersTransient PopulationPopulations are affected by the birth and death rate, as well as the number of people who move in and out each year. The birth rate is the percentage increase of the population due to births and the death rate is the percentage decrease of the population due to deaths. Write a program that displays the size of a population for any number of years. The program should ask for the following data: The starting size of a population P The annual birth rate (as a percentage of the population expressed as a fraction in decimal form)B The annual death rate (as a percentage of the population expressed as a fraction in decimal form)D The average annual number of people who have arrived A The average annual number of people who have moved away M The number of years to display nYears Write a function that calculates the size of the population after a year. To calculate the new population after one year, this function should use the formulaN = P + BP - DP + A - Mwhere N is the…Three numbersa. Write a program that reads three numbers and prints “all the same” if they are allthe same, “all different” if they are all different, and “neither” otherwise.b. Write a program that reads three numbers and prints “increasing” if they are inincreasing order, “decreasing” if they are in decreasing order, and “neither”otherwise. Here, “increasing” means “strictly increasing”, with each value largerthan its predecessor. The sequence 3 4 4 would not be considered increasing.c. Repeat part b. but before reading the numbers, ask the user whetherincreasing/decreasing should be “strict” or “lenient”. In lenient mode, thesequence 3 4 4 is increasing and the sequence 4 4 4 is both increasing anddecreasing
- Use C++ programming language A customer in a store is purchasing five items. The prices of the five items are:Price of item 1 = $15.95Price of item 2 = $24.95Price of item 3 = $6.95Price of item 4 = $12.95Price of item 5 = $3.95Write a program that holds the prices of the five items in five variables. Display each item’sprice, the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is7%.When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now, the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2/12 = 0.6%. The first months interest on $1,000 is 1000 0.006 = 6. Because the payment is $25 and the interest for the first month is $6, the payment toward the principal amount is 25 6 = 19. This means after making the first payment, the loan amount is 1,000 19 = 981. For the second payment, the interest is calculated on $981. So the interest for the second month is 981 0.006 = 5.886, that is, approximately $5.89. This implies that the payment toward the principal is 25 5.89 = 19.11 and the remaining balance after the second payment is 981 19.11 = 961.89. This process is repeated until the loan is paid. Write a program that accepts as input the loan amount, the interest rate per year, and the monthly payment. (Enter the interest rate as a percentage. For example, if the interest rate is 7.2% per year, then enter 7.2.) The program then outputs the number of months it would take to repay the loan. (Note that if the monthly payment is less than the first months interest, then after each payment, the loan amount will increase. In this case, the program must warn the borrower that the monthly payment is too low, and with this monthly payment, the loan amount could not be repaid.)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; }
- (Modify) a. Modify the program you wrote for Exercise 7 to provide the mass of a person as an output, given his or her weight as an input to the program. Use your program to determine the mass of a person who weighs 140 lbf on Earth. b. Modify the program written for Exercise 7a to also output the person’s weight on Mars and the moon. The pull of gravity on Mars is 12.54ft/sec2=3.728m/s2,andonthemoonis5.33ft/sec2=1.625m/s2.(Numerical) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters to 0, and then generate a large number of pseudorandom integers between 0 and 9. Each time a 0 occurs, increment the variable you have designated as the zero counter; when a 1 occurs, increment the counter variable that’s keeping count of the 1s that occur; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of the time they occurred.What is the output of the following code segment?inta=3,b=4;if(a==b);Write(X);Write(Y); X Y XY nothing