A. Make a program called FriendAges.java that creates variables to store the names of four friends,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A. Make a program called FriendAges.java that creates variables to store the names of four friends, and separate variables to store the ages of those friends. Next, add up the ages of all four friends and store the result in an additional variable; then use division to calculate their average age and put the result in its own variable. Finally, output the name and age of each person, as well as the sum and average of their ages. This part does not require user input or test cases--the program just runs and outputs as directed. B. Write a program called GasPrice.java that defines a named constant to represent the price of gas per gallon for regular gas, and a second named constant for the price per gallon of premium gas. Prompt the user to input how much gas they need. Calculate the cost of purchasing each option (using those constants) and save the results in two variables. Finally, output the results. Be sure to include test cases as shown earlier in this Module. Sample program run for Part B, with user input. Note that yours doesn't need to match exactly. How many gallons of gas do you wish to purchase? 16 Total for regular gas at 3.29 per gallon: $52.64 Total for premium gas at 3.49 per gallon: $55.84 A. Make a program called FriendAges.java that creates variables to store the names of four friends, and separate variables to store the ages of those friends. Next, add up the ages of all four friends and store the result in an additional variable; then use division to calculate their average age and put the result in its own variable. Finally, output the name and age of each person, as well as the sum and average of their ages. This part does not require user input or test cases--the program just runs and outputs as directed. B. Write a program called GasPrice.java that defines a named constant to represent the price of gas per gallon for regular gas, and a second named constant for the price per gallon of premium gas. Prompt the user to input how much gas they need. Calculate the cost of purchasing each option (using those constants) and save the results in two variables. Finally, output the results. Be sure to include test cases as shown earlier in this Module. Sample program run for Part B, with user input. Note that yours doesn't need to match exactly. How many gallons of gas do you wish to purchase? 16 Total for regular gas at 3.29 per gallon: $52.64 Total for premium gas at 3.49 per gallon: $55.84
Expert Answer:
Related Book For
International Marketing And Export Management
ISBN: 9781292016924
8th Edition
Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr
Posted Date:
Students also viewed these databases questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
Python and most Python libraries are free to download or use, though many users use Python through a paid service. Paid services help IT organizations manage the risks associated with the use of...
-
Custom Truck Builders frequently uses long-term lease contracts to finance the sale of its trucks. On November 1, 2015, Custom Truck Builders leased to Interstate Van Lines a truck carried in the...
-
You are evaluating an outstanding issue of $1,000 par value bonds with an 8.75% coupon rate that mature in 25 years and make quarterly interest payments. If the current market price for the bonds is...
-
Match each task or property of a regression model in the left-hand column with an expression in the right-hand column. Test whether adding X 1 improves fit of model (a) t-statistic for b 1 (b) 1 - R...
-
Refer to the information from QS 21-18. Compute the variable overhead spending variance and the variable overhead efficiency variance and classify each as favorable or unfavorable. Data From QS 21-18...
-
West Palm Company engaged in the following transactions involving promissory notes: May 3 Sold engines to Mittal Company for $120,000 in exchange for a 90-day, 12 percent promissory note. 16 Sold...
-
Arbon Company has three service departments and two operating departments. Selected data concerning the five departments are presented below: Costs Number of employees Square metres of space occupied...
-
A manufacturer of dental implants observed that when it increased the number of dental implants and priced them differently, the overall sales increased. Explain this phenomenon?
-
Sales $ 1 5 9 , 0 0 0 , Variable costs $ 8 3 , 0 0 0 , Contribution margin $ 7 6 , 0 0 0 , fixed costs $ 9 1 , 0 0 0 and operating income ( loss ) $ - 1 5 , 0 0 0 , if it drops off the product line,...
-
The total sound field is due to two coherent sound sources (p) and p2) of same frequency. Suppose pi=(2+3 i) x 104 Pa, and p2=4 e34 x 104 Pa. (a) What is the total pressure? Express your answer in...
-
A financial advisor puts a total of $34,000 into two accounts. At the end of the year, account A gained 8% and account B gained 6%. If the accounts together earned $2332.40, how much did the advisor...
-
A company plans to buy a machine costing $ 5 6 0 , 0 0 0 . It has a residual value of $ 2 3 , 7 0 0 and an expected useful life of five years. Compute the average investment.
-
d) o = 15.1, 15% above 16.6; u= ? Choose the correct graph below. OB. OC. OD. O A. 16.6 18.6 16.6 16.6 G= 15.1, 15% above 16.6; u= ? Find the mean. p= (Round to one decimal place as needed.)
-
In Exercises, find the equation of the tangent line at the given point on each curve. 2y 2 - x = 4; (16, 2)
-
Discuss the relationship between objective and strategy in pricing.
-
In late 2004, British fashion designer Sara Berman received an unexpected telephone call from Andrea Ragnetti, chief marketing officer for Royal Philips Electronics. Figuring the Dutch company wanted...
-
Introduction Dell, Inc. was the worlds market leader in personal computers using direct sales through the Internet and over the telephone until 2005. In 2006, it experienced an unexpected decline in...
-
Fitch and Wall have been in partnership for many years sharing profits and losses in the ratio 5:3 respectively. The following was their statement of financial position as at 31 December 2016: On 1...
-
When you were looking at goodwill in the previous chapter, you were interested in the difference between the amount received and the value of net assets. Why do we consider only the assets when there...
-
Alan, Bob and Charles are in partnership sharing profits and losses in the ratio 3:2:1 respectively. The statement of financial position for the partnership as at 30 June 2016 is as follows: Charles...
Study smarter with the SolutionInn App