scores entered, the highest score, the average. Save the file as QuizScoreStatistics.java. 9. The Freemont Automobile Factory has set a goal that each worker will eventually produce 10,000 parts per month. The company has discovered that the longer a worker has been on the job, the more parts the worker can produce. Write an application that prompts for the number of parts a worker currently produces. Then compute and display a worker's anticipated output

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Java programming : I can’t figure question 9 out. Help would be appreciated of any input or output. Thanks!
232
a m
multiple of 50 (50, 100, 150, and so on). Save the file as CountByFives.java.
Write an application that includes final constants named START and STOP that are set to ad
respectively. The application counts by five from 5 through 500 inclusive, and it starts a new te
b. Modify the Count ByFives application so that the user enters the value to count by. Start each wy
after 10 values have been displayed. Save the file as CountByAnything.java.
Write an application that asks a user to type an even number or the sentinel value 999 to stop. When
types an even number, display the message Good job! and then ask for another input. When the us
odd number, display an error message and then ask for another input. When the user types the senti
999, end the program. Save the file as EvenEntryLoop.java.
3. Write an application that displays the factorial for every integer value from 1 to a user-entered limit. A
factorial is 4 3 2 1, or 24. (You can use the int data type for the factorial, but if you enter:
of a number is the product of that number multiplied by each positive integer lower than it. For exam
than 16, the results will be unexpected because the factorial value exceeds the largest value that can be
4. Write an application that prompts a user for two integers and displays every Integer between them. D
message if there are no integers between the entered values. Make sure the program works regardless
entered value is larger. Save the file as Inbetween.java.
5. Write an application that displays every perfect number from 1 through a user-supplied limit. A perfect
is one that equals the sum of all the numbers that divide evenly into it.
For example, 6 is perfect because 1, 2, and 3 divide evenly into it, and
their sum is 6; however, 12 is not a perfect number because 1, 2, 3, 4,
and 6 divide evenly into it, and their sum is greater than 12. Save the
in an int.) Save the file as Factorials.java.
file as Perfect.java.
Programming Exercises
2.
CHAPTER 6 LOOPING
A
6. Write an application that prompts the user for a single-digit integer
and uses a loop to create the pattern shown in the example in
Figure 6-32. In the example, the user entered a 3, and 10 lines are
displayed; each 3 appears one additional space to the right. Save the
file as DiagonalNums.java.
7. Accept a digit from the user, then display a seven-line triangle pattern
that uses the digit. Figure 6-33 shows a typical execution. The
program can contain no more than three output statements. Save the
file as Triangle WithLoops.java.
8. Write an application that allows a user to enter any number of student
quiz scores until the user enters a sentinel 99. If the score entered is less
than 0 or greater than 10, display an appropriate message and do not use
the score. After all the scores have been entered, display the number of
scores entered, the highest score, the lowest score, and the arithmetic
average. Save the file as QuizScoreStatistics.java.
worker
10. Write an applic
Figure 6-32 Typical exe
the DiagonalNums applicati
Enter a single digit»
9. The Freemont Automobile Factory has set a goal that each worker will
eventually produce 10,000 parts per month. The company has discovered
that the longer a worker has been on the job, the more parts the worker can
produce. Write an application that prompts for the number of parts a worker
currently produces. Then compute and display a worker's anticipated output
amount of money the
b. Modily the Retireme
11. Assume that the p
Accept two valoes from a
assumption for an
15 percent decreas
every year until the pe
took. Save the file as
12. a. The Huntington
named All, Bob
points scored
chart that ill
asterisk for
in Figure
Figure 6-33 Typical exe
of the TriangleWithLoog
application
Enter a digit >> 4
4
444
44444
4444444
444444444
b. Modity 15
points=
displaz
For e
four
БАДАДААДАДАДА
13. Create
invois
set c
set
m
a
.
Transcribed Image Text:232 a m multiple of 50 (50, 100, 150, and so on). Save the file as CountByFives.java. Write an application that includes final constants named START and STOP that are set to ad respectively. The application counts by five from 5 through 500 inclusive, and it starts a new te b. Modify the Count ByFives application so that the user enters the value to count by. Start each wy after 10 values have been displayed. Save the file as CountByAnything.java. Write an application that asks a user to type an even number or the sentinel value 999 to stop. When types an even number, display the message Good job! and then ask for another input. When the us odd number, display an error message and then ask for another input. When the user types the senti 999, end the program. Save the file as EvenEntryLoop.java. 3. Write an application that displays the factorial for every integer value from 1 to a user-entered limit. A factorial is 4 3 2 1, or 24. (You can use the int data type for the factorial, but if you enter: of a number is the product of that number multiplied by each positive integer lower than it. For exam than 16, the results will be unexpected because the factorial value exceeds the largest value that can be 4. Write an application that prompts a user for two integers and displays every Integer between them. D message if there are no integers between the entered values. Make sure the program works regardless entered value is larger. Save the file as Inbetween.java. 5. Write an application that displays every perfect number from 1 through a user-supplied limit. A perfect is one that equals the sum of all the numbers that divide evenly into it. For example, 6 is perfect because 1, 2, and 3 divide evenly into it, and their sum is 6; however, 12 is not a perfect number because 1, 2, 3, 4, and 6 divide evenly into it, and their sum is greater than 12. Save the in an int.) Save the file as Factorials.java. file as Perfect.java. Programming Exercises 2. CHAPTER 6 LOOPING A 6. Write an application that prompts the user for a single-digit integer and uses a loop to create the pattern shown in the example in Figure 6-32. In the example, the user entered a 3, and 10 lines are displayed; each 3 appears one additional space to the right. Save the file as DiagonalNums.java. 7. Accept a digit from the user, then display a seven-line triangle pattern that uses the digit. Figure 6-33 shows a typical execution. The program can contain no more than three output statements. Save the file as Triangle WithLoops.java. 8. Write an application that allows a user to enter any number of student quiz scores until the user enters a sentinel 99. If the score entered is less than 0 or greater than 10, display an appropriate message and do not use the score. After all the scores have been entered, display the number of scores entered, the highest score, the lowest score, and the arithmetic average. Save the file as QuizScoreStatistics.java. worker 10. Write an applic Figure 6-32 Typical exe the DiagonalNums applicati Enter a single digit» 9. The Freemont Automobile Factory has set a goal that each worker will eventually produce 10,000 parts per month. The company has discovered that the longer a worker has been on the job, the more parts the worker can produce. Write an application that prompts for the number of parts a worker currently produces. Then compute and display a worker's anticipated output amount of money the b. Modily the Retireme 11. Assume that the p Accept two valoes from a assumption for an 15 percent decreas every year until the pe took. Save the file as 12. a. The Huntington named All, Bob points scored chart that ill asterisk for in Figure Figure 6-33 Typical exe of the TriangleWithLoog application Enter a digit >> 4 4 444 44444 4444444 444444444 b. Modity 15 points= displaz For e four БАДАДААДАДАДА 13. Create invois set c set m a .
ATED
Co
RAGE INFORMA
M
73000-4-A
Al App
10. a.
each month for 24 months, assuming the worker's production increases by 6 percent each month. Also display a
message that shows the month number in which production exceeds 10,000 parts or a message indicating that the
worker will not reach the goal within 24 months. Save the file as Increased Production.java.
DEBUGGING EXERCISES
Write an application that prompts a user for the number of years the user has until retirement and the
amount of money the user can save annually. If the user enters 0 or a negative number for either value.
reprompt the user until valid entries are made. Assume that no interest is earned on the money. Display the
amount of money the user will have at retirement. Save the file as RetirementGoal.java.
b. Modify the Retirement Goal application to display the amount of money the user will have if the user
earns 4 percent interest on the balance every year. Save the file as RetirementGoal2.java.
12. a. The Huntington High School basketball team has five players
named Ali, Bob, Cai, Dan, and Eli. Accept the number of
points scored by each player in a game, and create a bar
chart that illustrates the points scored by displaying an
asterisk for each point. The output looks similar to the chart
in Figure 6-34. Save the file as BarChart.java.
233
11. Assume that the population of Mexico is 128 million and the population of the United States is 323 million.
Accept two values from a user: an assumption of an annual increase in the population of Mexico and an
assumption for an annual decrease in the U.S. population. Accept both figures as percentages; in other words, a
1.5 percent decrease is entered as 0.015. Write an application that displays the populations of the two countries
every year until the population of Mexico exceeds that of the United States, and display the number of years it
took. Save the file as Population.java.
b. Modify the BarChart program to accept the number of
points scored by each player in a season. The bar chart
displays one asterisk for each 10 points scored by a player.
For example, if a player has scored 48 points, then display
risks. Save the program as BarChart2.java.
Ench Purchase contains an
Inles tax. Include
the
Figure 6-34 Typical execution of the
BarChart application
Enter points earned by Ali >> 5
Enter points earned by Bob >> 8
Enter points earned by Cai >> 14
Enter points earned by Dan >> 7
Enter points earned by Eli >> 2
Points for Game
Ali *****
Bob
**************
Cai
Dan *******
Eli **
amount. Also include a displa
lantion that de
Transcribed Image Text:ATED Co RAGE INFORMA M 73000-4-A Al App 10. a. each month for 24 months, assuming the worker's production increases by 6 percent each month. Also display a message that shows the month number in which production exceeds 10,000 parts or a message indicating that the worker will not reach the goal within 24 months. Save the file as Increased Production.java. DEBUGGING EXERCISES Write an application that prompts a user for the number of years the user has until retirement and the amount of money the user can save annually. If the user enters 0 or a negative number for either value. reprompt the user until valid entries are made. Assume that no interest is earned on the money. Display the amount of money the user will have at retirement. Save the file as RetirementGoal.java. b. Modify the Retirement Goal application to display the amount of money the user will have if the user earns 4 percent interest on the balance every year. Save the file as RetirementGoal2.java. 12. a. The Huntington High School basketball team has five players named Ali, Bob, Cai, Dan, and Eli. Accept the number of points scored by each player in a game, and create a bar chart that illustrates the points scored by displaying an asterisk for each point. The output looks similar to the chart in Figure 6-34. Save the file as BarChart.java. 233 11. Assume that the population of Mexico is 128 million and the population of the United States is 323 million. Accept two values from a user: an assumption of an annual increase in the population of Mexico and an assumption for an annual decrease in the U.S. population. Accept both figures as percentages; in other words, a 1.5 percent decrease is entered as 0.015. Write an application that displays the populations of the two countries every year until the population of Mexico exceeds that of the United States, and display the number of years it took. Save the file as Population.java. b. Modify the BarChart program to accept the number of points scored by each player in a season. The bar chart displays one asterisk for each 10 points scored by a player. For example, if a player has scored 48 points, then display risks. Save the program as BarChart2.java. Ench Purchase contains an Inles tax. Include the Figure 6-34 Typical execution of the BarChart application Enter points earned by Ali >> 5 Enter points earned by Bob >> 8 Enter points earned by Cai >> 14 Enter points earned by Dan >> 7 Enter points earned by Eli >> 2 Points for Game Ali ***** Bob ************** Cai Dan ******* Eli ** amount. Also include a displa lantion that de
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY