Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

Can you help me do this Java Program

CS140-02, TSU
Project 2 Arithmetic Calculations
Due on Sunday, 1/29/2023, by 11:59pm
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:
• 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
Created by Li Ma
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,
2. Crea
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
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_Your Name.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_YourName.docx
expand button
Transcribed Image Text:CS140-02, TSU Project 2 Arithmetic Calculations Due on Sunday, 1/29/2023, by 11:59pm 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: • 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 Created by Li Ma 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, 2. Crea 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 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_Your Name.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_YourName.docx
Sample Output
Enter first integer: 10
Enter second integer: 201
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 have 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.
expand button
Transcribed Image Text:Sample Output Enter first integer: 10 Enter second integer: 201 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 have 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
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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.
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education