1 of 4 C++ Practice Activities (General math) The perimeter, approximate surface area, and approximate volume of an in-g
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
1 of 4 C++ Practice Activities (General math) The perimeter, approximate surface area, and approximate volume of an in-g
(Data processing) a. Write a C++ program to compute and display a person's weekly salary as determined by the following conditions: If the hours worked are less than or equal to 40, the person receives $12.00 per hour otherwise, the person receives $480.00 plus $17.00 for cach hour worked over 40 hours. The program should request the hours worked as input and display the salary as output (General math) The area of an ellipse (see Figure 3.5) is given by this formula: Area - na Using this formula, write a C++ program to calculate the area of an ellipse having a minor anis, 4of 2.5 inches and a major axis, b. of 6.4 inches Figure 3.5 The minor axis, a, and the major axis, b, of an ellipse A milk carton can hold 3.78 liters of milk. Each morning, a dairy farm ships cartons of milk to a local grocery store. The cost of producing one liter of milk is $0.38, and the profit of each carton of milk is $0.27. Write a program that does the following: #Prompts the user to enter the total amount of milk produced in the morning . Outputs the number of milk cartons needed to hold milk. (Round your answer to the nearest integer.) Outputs the cost of producing milk. d. Outputs the profit for producing milk.
The following program has syntax errors. Correct them. On each successive line, assume that any preceding error has been corrected. #include <iostream> using namespace std; int main() int temp: string first; cout << "Enter first name: ; cin >> first cout << endl; cout << "Enter last name: ; cin >> last; cout << endl; cout << "Enter today's temperature: "; cin >> temperature; cout << endl; cout << first << " " << last << today's temperature is: "; << temperature << endl; return 0;
Consider the following C++ program in which the statements are in the incorrect order. Rearrange the statements so that it prompts the user to input the length and width of a rectangle and output the area and perimeter of the rectangle #include <iostream> int main() cout << "Enter the length: "; cin >> length; cout << endl; int length; area - length • width; return 0; int width: cin>> width; cout << "Enter the width: cout << endl; cout << "Area - « area << endl; cout << "Perimeter - " << perimeter << endl; int area; using namespace std; int perimeter;