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...
-
Bar AB is rotating clockwise and, at the instant shown, the magnitude of the velocity of point G is 3.6 m/s. Determine the angular velocity of each of the three bars at that instant. 120 mm B 145 120...
-
It has been three years since Mohammed Al-Tamimi opened his computer repair business, Mos Mending Station. Unlike the well-known Nerd Squad of the big electronics retailer, Mos Mending Station fixes...
-
A marketed asset's price \(x\) is governed by the mean reverting process where \(\eta, \theta\), and \(\sigma\) are positive constants and \(z\) is a Wiener process. (a) Let \(V(x, t)\) be a given...
-
Frenchvanilla Company earned net income of $ 75,000 during the year ended December 31, 2014. On December 15, Frenchvanilla declared the annual cash dividend on its 5% preferred stock (par value, $...
-
Here is the link for data using in it :https://drive.google.com/drive/folders/1XCCzbwh8bxsWuiJI9LTVQnUPLMfXqQWj?usp=drive_link How do I get the system mass, spring ,damping, setting time the correct...
-
The finance director of RM plc is considering several investment projects and has collected the following information about them. Projects D and E are mutually exclusive. The capital available for...
-
Northwest Publishing Company has two Service Departments and two Operating Departments. Administration costs are allocated using the Number of Employees; Maintenance is allocated using the Square...
-
read the following articles: 1) https://www.nationalreview.com/2021/08/the-problem-with-supermax-prisons/ 2)...
-
Concepts of Positive Psychology . Find a website that reflects important positive psychology concepts and that would contribute to a person's overall well-being. Post a link to this website. Provide...
-
Employment law reflections Due Tuesday by 11:59pm Points 50 Available Feb 15 at 12am - May 9 at 11:59pm Submitting a text entry box Start Assignment Write a 3-4 paragraph reflection on a topic from...
-
How does the process of socialization, as conceptualized by George Herbert Mead, contribute to the development of the "self" and the formation of individual identity within society ?
-
A paralegal has been served with a court order that requires you to attend at court to produce certain documents and information regarding one of your clients. Do you need your client's consent?...
-
When a firm produces an information product the initial or fixedcosts are a. high b. low c. unpredictable d. low or high...
-
Dr. Chan obtained a $15,000 demand loan at prime plus 1.5% on September 13 from the Bank of Montreal to purchase a new dental X-ray machine. Fixed payments of $700 will be deducted from the dentists...
-
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.
-
Consider the sample space \(S=\{y y, y n, n y, n n\}\) in Example 2.2. Suppose that the subset of outcomes for which at least one camera conforms is denoted as \(E_{1}\). Then, \[ E_{1}=\{y y, y n, n...
-
Each message in a digital communication system is classified as to whether it is received within the time specified by the system design. If three messages are classified, use a tree diagram to...
-
The design for a Website is to consist of four colors, three fonts, and three positions for an image. From the multiplication rule, \(4 \times 3 \times 3=36\) different designs are possible.
Study smarter with the SolutionInn App