Sample Output Enter first integer: 10 Enter second integer: 20 Enter third integer: 30 For the numbers 10, 20 and 30 Largest is 30 Smallest is 10 Sum is 60 Product is 6000 Average is 20

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question
100%

Can you help me to do this Java program please? Thank you!

Lab Objectives
This project was designed to reinforce programming concepts from Chapter 2 of Java How to
Program: 11/e. In this lab you will practice:
●
Project 2 - Arithmetic Calculations
Due on Sunday, 1/29/2023, by 11:59pm
●
Using the Scanner class to obtain input from the user
Using printf to output information to the user
Using arithmetic operators to perform calculations
Using if statements to make decisions based on the truth or falsity of a condition
Using relational operators to compare variable values
The follow-up questions and activities also will give you practice:
Understanding a common programming error with if statements
Problem Description
1. Choose whatever compiler you like to work on programming for this project
a. If you decide to use the GDB online Java compiler,
i. here is the URL: https://www.onlinegdb.com/online java compiler
ii. delete all existing code in the editor if there is any
iii. edit your code into the blank editor
2. Create a Java application that
a. requests three integers from the user
b. calculates the sum, average, & product of these three numbers
c. compares them to get the smallest and largest of the numbers
d. displays the sum, average, product, smallest and largest of the numbers
3. Run your program after correcting all errors in the code
a. Your output should be like the sample output shown below
4. Save you program as Project2_Arithmetic_YourName.java
5. Take a screenshot of your whole compiler window and save the image as
Project2_Arithmetic_YourName.png
a. Make sure that all output lines are displayed
6. Answer the follow-up questions in a separated Word document and name it
Project2_Answers_Your Name.docx
Transcribed Image Text:Lab Objectives This project was designed to reinforce programming concepts from Chapter 2 of Java How to Program: 11/e. In this lab you will practice: ● Project 2 - Arithmetic Calculations Due on Sunday, 1/29/2023, by 11:59pm ● Using the Scanner class to obtain input from the user Using printf to output information to the user Using arithmetic operators to perform calculations Using if statements to make decisions based on the truth or falsity of a condition Using relational operators to compare variable values The follow-up questions and activities also will give you practice: Understanding a common programming error with if statements Problem Description 1. Choose whatever compiler you like to work on programming for this project a. If you decide to use the GDB online Java compiler, i. here is the URL: https://www.onlinegdb.com/online java compiler ii. delete all existing code in the editor if there is any iii. edit your code into the blank editor 2. Create a Java application that a. requests three integers from the user b. calculates the sum, average, & product of these three numbers c. compares them to get the smallest and largest of the numbers d. displays the sum, average, product, smallest and largest of the numbers 3. Run your program after correcting all errors in the code a. Your output should be like the sample output shown below 4. Save you program as Project2_Arithmetic_YourName.java 5. Take a screenshot of your whole compiler window and save the image as Project2_Arithmetic_YourName.png a. Make sure that all output lines are displayed 6. Answer the follow-up questions in a separated Word document and name it Project2_Answers_Your Name.docx
Sample Output
Enter first integer: 10
Enter second integer: 20
Enter third integer: 30
For the numbers 10, 20 and 30
Largest is 30
Smallest is 10
Sum is 60
Product is 6000
Average is 20
Problem-solving Tips
1. Prompt the user for three integer values and use Scanner method nextInt to read
them into their respective int variables
2. Use a series of if statements to determine the smallest and largest numbers. You must
use relational operators in the if conditions to compare two numbers at a time
3. The calculation of the average in this exercise should result in an integer representation
of the average. So, if the sum of the values is 7, the average should be 2, not 2.3333....
4. You should declare the variables for three inputs, three calculation results, and two
comparison results before use them
5. Test your program thoroughly using different test inputs and determine whether your
program produces the correct results
a. Try entering 10, 20, and 30 to see if your results match the sample output above
Make sure the class name is same as the file name
6.
7. Be sure to follow the spacing and indentation conventions shown in the class example
8. If you ave any questions as you proceed, ask your instructor for assistance
Follow-Up Questions and Activities
1. Place a semicolon at the end of the condition of an if statement in your solution that is
used to help determine the largest and smallest values. What happens? Explain.
Submission
Submit all three files: the Java program Project2_Arithmetic_YourName.java (70%), the
screenshot image Project2_Arithmetic_YourName.png (20%), and the answer to the follow-up
questions Project2_Answers_YourName.docx (10%) to Blackboard via the link Project2 in
Assignments section on the course page.
Transcribed Image Text:Sample Output Enter first integer: 10 Enter second integer: 20 Enter third integer: 30 For the numbers 10, 20 and 30 Largest is 30 Smallest is 10 Sum is 60 Product is 6000 Average is 20 Problem-solving Tips 1. Prompt the user for three integer values and use Scanner method nextInt to read them into their respective int variables 2. Use a series of if statements to determine the smallest and largest numbers. You must use relational operators in the if conditions to compare two numbers at a time 3. The calculation of the average in this exercise should result in an integer representation of the average. So, if the sum of the values is 7, the average should be 2, not 2.3333.... 4. You should declare the variables for three inputs, three calculation results, and two comparison results before use them 5. Test your program thoroughly using different test inputs and determine whether your program produces the correct results a. Try entering 10, 20, and 30 to see if your results match the sample output above Make sure the class name is same as the file name 6. 7. Be sure to follow the spacing and indentation conventions shown in the class example 8. If you ave any questions as you proceed, ask your instructor for assistance Follow-Up Questions and Activities 1. Place a semicolon at the end of the condition of an if statement in your solution that is used to help determine the largest and smallest values. What happens? Explain. Submission Submit all three files: the Java program Project2_Arithmetic_YourName.java (70%), the screenshot image Project2_Arithmetic_YourName.png (20%), and the answer to the follow-up questions Project2_Answers_YourName.docx (10%) to Blackboard via the link Project2 in Assignments section on the course page.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning