This is where I post my C++ answers!
I am using Starting Out With C++ Early Object, 9th Edition, Gaddis, Tony.
-
Miles per Gallon
Write a program that calculates a car's gas mileage. The program should ask the user to enter the number of gallons of gas the car can hold and the number of miles it can be driven on a full tank . It should then calculate and display the number of miles per gallon the car gets.
Source Code -
Stadium Seating
There are three seating categories at a stadium . For a softball game, Class A seats cost $15, Class B seats cost $12, and Class C seats cost $9. Write a program that asks how many tickets for each class of seats were sold, then displays the amount of income generated from ticket sales. Format your dollar amount in a fixed-point notation with two decimal points and make sure the decimal point is always displayed.
Source Code -
Housing Costs
Write a program that asks the user to enter their monthly costs for each of the following housing-related expenses: • rent or mortgage payment • phones • utilities • cable The program should then display the total monthly cost of these expenses and the total annual cost of these expenses.
Source Code -
How Much Insurance?
Many financial experts advise property owners to insure their homes or buildings for at least 80 percent of the amount it would cost to replace the structure. Write a program that asks the user to enter the replacement cost of a building and then displays the minimum amount of insurance that should be purchased for the property .
Source Code -
Batting Average
Write a program to find a baseball player's batting average . The program should ask the user to enter the number of times the player was at bat and the number of hits earned. It should then display the batting average to four decimal places.
Source Code -
Test Average
Write a program that asks for five test scores. The program should calculate the average test score and display it. Th e number displayed should be formatted in fixed-point notation, with one decimal point of precision.
Source Code -
Average Rainfall
Write a program that calculates the average monthly rainfall for three months. The program should ask the user to enter the name of each month, such as June or July, and the amoun t of rain (in inches) that fell that month. The program should display a message similar to the following: The average monthly rainfall for June, July, and August was 6.72 inches.
Source Code -
Male and Female Percentages
Write a program that asks the user for the number of males and the number of females registered in a class. The program should compute and report what percentage of the student s are males and what percentage are females. Display the output with two decimal points. If you remembered to convert the decimal result of each calculation to percent form when you displayed it, the two values should add up to 100.00 percent.
Source Code -
Vacation Days
Write a program that prompts the users to enter the number of days they plan to spend on their next vacation. Then compute and report how long that is in hours, in minutes, and in seconds.
Source Code -
Box Office
A movie theater only keeps 80 percent of the revenue earned from ticket sales. The other 20 percent goes to the distibutor. Write a program that calculates a theater's gross and net box office revenue for a night. The program should ask for the name of the movie, and how many adult and child tickets were sold. (The price of an adult ticket is $10 and a child's ticket is $6.) It should display a report similar to the following:
Movie Name: "Wheel of Fury"
Adult Tickets Sold: 382
Child Tickets Sold: 127
Gross Box Office Revenue: $ 4582.00
Amount Paid to Distributor: - $ 916.40
Net Box Office Revenue: $ 3665.60
Source Code -
How Many Widgets?
The Yukon Widget Company manufactures widgets that weigh 12.5 pounds each . Write a program that calculates how many widgets are stacked on a pallet, based on the total weight of the pallet. The program should ask the user how much the pallet weighs by itself and with the widgets stacked on it. It should then calculate and display the number of widgets stacked on the pallet.
Source Code -
How Many Calories?
A bag of cookies holds 30 cookies. The calorie information on the bag claims that there are 10 "servings" in the bag and that a serving equals 240 calories. Write a program that asks the user to input how many cookies they actually ate and then reports how many total calories were consumed .
Source Code -
Ingredients Adjuster
A cookie recipe calls for the following ingredients:
• 1.5 cups of sugar
• 1 cup of butter
• 2. 75 cups of flour
The recipe produces 48 cookies with these amounts of the ingredients. Write a program that asks the user how many cookies he or she wants to make and then displays the number of cups of each ingredient needed for the specified number of cookies.
Source Code -
Celsius to Fahrenheit
Celsius to Fahrenheit Write a program that converts Celsius temperatures to Fahrenheit temperatures . The formula is
F = 9/5C + 32
where F is the Fahrenheit temperature and C is the Celsius temperature. The program should prompt the user to input a Celsius temperature and should display the corresponding Farenheit temperature.
Source Code -
Currency
Write a program that will convert U.S. dollar amounts to Japanese yen and to euros, storing the conversion factors in the constant variab les YEN_PER_DOLLAR and EUROS_PER_DOLLAR. To get the most up-to-date exchange rates, search the Internet using the term "currency exchange rate" or "currency converter." If you cannot find the most recent exchange rates, use the following:
1 Dollar= 120.005 Yen
1 Dollar= .881 Euros
Source Code