Write a java program that asks the user for two integer numbers. The program should calculate...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a java program that asks the user for two integer numbers. The program should calculate the average of the numbers. For example, if the user enters 2 (first number) and 3 (second number), the result is 2.5. You must create a method that receives two numbers from the main method and returns the average to the caller. Possible program structure and its functions: 1) main method Ask user for integer numbers Call a method and pass the two numbers. Receive the result from the method. Print the result. 2) a method Receive two numbers from main method. Calculate the average of the numbers Return the average to the caller. ** do not print anything in this method. REQUIREMENT: Data type of the input numbers must be int and the average must be double. You must use the concept of 'type casting' when calculating the average. Write a java program that asks the user for two integer numbers. The program should calculate the average of the numbers. For example, if the user enters 2 (first number) and 3 (second number), the result is 2.5. You must create a method that receives two numbers from the main method and returns the average to the caller. Possible program structure and its functions: 1) main method Ask user for integer numbers Call a method and pass the two numbers. Receive the result from the method. Print the result. 2) a method Receive two numbers from main method. Calculate the average of the numbers Return the average to the caller. ** do not print anything in this method. REQUIREMENT: Data type of the input numbers must be int and the average must be double. You must use the concept of 'type casting' when calculating the average.
Expert Answer:
Answer rating: 100% (QA)
Here is the code of a Java program that calculates the average of two numbers entered by the user im... View the full answer
Related Book For
Starting Out With Java From Control Structures Through Data Structures
ISBN: 9780133957051
6th Edition
Authors: Tony Gaddis
Posted Date:
Students also viewed these programming questions
-
jorge commutes both to his job and to school, driving a total of about 250 miles per week. His current car is fully paid off, but it's getting old. He spends about $1800 per year on repairs, and the...
-
In this programming assignment you will practice using ArrayLists, Inheritance and Polymorphism. You are to write a game called Magical Creatures War. You will do this by implementing a class called...
-
Anita Daye is investigating purchasing an ice cream franchise from Creamery, Inc., to sell various ice cream dishes under the Creamery, Inc. name. She has compiled the following information: 1) She...
-
Phoenix Corp. faltered in the recent recession but is recovering. Free cash flow has grown rapidly. Forecasts made in 2016 are as follows. Phoenix's recovery will be complete by 2021, and there will...
-
Justify your answer by analysing in a table the degree of risk, from high to low for each factor across each approach.
-
Group dynamics are important elements within the leading facet of the P-O-L-C framework. Discuss a time in your professional, school, or personal life when you experienced the Five Stages of Group...
-
Japanese IQ scores. The Wechsler Intelligence Scale for Children is used (in several languages) in the United States and Europe. Scores in each Chapter 13 Exercises 285 case are approximately...
-
Andrea (see E13-1) has studied the information you gave her in that exercise and has come to you with more statements about corporations. 1. Corporation management is both an advantage and a...
-
Q10 You've assembled the following portfolio: Part 1 What is the beta of the portfolio? Part 2 What is the expected return of your portfolio
-
The Buse Sound, Ltd. has three divisions for selling music: Cassette, Vinyl, and CD. The divisions have the following revenues and expenses for June 2022: Cassette Vinyl CD Revenues $82,000 $430,000...
-
DICIGNON XCO Remaining Time: 2 hours, 22 minutes, 47 seconds. Question Completion Status: QUESTION 12 JRE2 Inc, entered into a contract to install a pipeline for a fixed price of $2.395,000.JRE2...
-
On January 1, 20X1, Popular Creek Corporation organized SunTime Company as a subsidiary in Switzerland with an initial investment cost of Swiss francs (SFr) 76,000. SunTime's December 31, 20X1, trial...
-
In November 2 0 2 4 , Lily informed you that she needs additional cash flow to meet her personal debt obligations. Lily does not want to sell more stock than she needs to because she wants...
-
Bennett limited provides mobile library services to the community of longbourn. bennett has preliminary operating results for the first year and the company found that net income is different from...
-
What is printed when the value of x is 34? if (x < 32 ) { if (x22) { } System.out.println("Blue"); else if (x <10) { } System.out.println("Red"); else if (x > 25 ) { System.out.println("Yellow"); } }...
-
Heidi expresses concern in the video that when employees are also friends, holding them accountable for performance "doesn't come as naturally" to her. She asks you, "Does my focus on relationship...
-
Caro Manufacturing has two production departments, Machining and Assembly, and two service departments, Maintenance and Cafeteria. Direct costs for each department and the proportion of service costs...
-
To balance the chemical equation SiH3 + O2 SiO2 + HO, you could introduce coefficients a, b, c, d and write aSiH3 + bO2 cSiO + dHO then write linear equations for each element. The equation for Si...
-
If you have downloaded the books source code from www.pearsonhighered.com/gaddis, you will find a partially written program named AreaRectangle.java in this chapters source code folder. Your job is...
-
True or False: A class may only implement one interface.
-
True or False: If toLowerCase methods argument is already lowercase, it will be inadvertently converted to uppercase.
-
1. What criteria does a state or local government apply to determine whether to capitalize a lease?
-
2. On January 1, 2008, a city signs a capital lease for new equipment for the police department. How does it report this transaction on the government-wide financial statements? On the fund-based...
-
3. On December 31, 2008, the city in question 2 makes its first annual lease payment. How does it report the payment on the government-wide financial statements? On the fund-based financial...
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App