1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Gre4nikov [31]
3 years ago
13

Create a program named MealPriceCalculation that prompts users enter a meal price and the tip and then calculate and display the

total meal price. The program should have a Main () and then use two overloaded methods of the same name to calculate and display the total meal price twice: the first one accepts a meal price (double) and a tip amount in dollars (double), and the second one accepts a meal price (double) and a tip in percentage (int) of the meal price.
Computers and Technology
1 answer:
Blizzard [7]3 years ago
4 0

Answer:

  1. import java.util.Scanner;
  2. public class MealPriceCalculation{
  3.    public static void main(String[] args) {
  4.        Scanner input = new Scanner(System.in);
  5.        System.out.print("Enter meal price: ");
  6.        double meal = input.nextDouble();
  7.        System.out.print("Enter tip: ");
  8.        double tip = input.nextDouble();
  9.        calculatePrice(meal,tip);
  10.        calculatePrice(meal,(int)tip);
  11.    }
  12.    public static void calculatePrice(double meal, double tip){
  13.        System.out.println("Total meal price: $" + (meal + tip) );
  14.    }
  15.    public static void calculatePrice(double meal, int tip){
  16.        System.out.println("Total meal price $" + (meal+tip));
  17.    }
  18. }

Explanation:

The solution code is written in Java.

Overload methods are the methods that share the same name but with different method signature. In this question, we create two overload methods calculatePrice (Line 17-23). One version will accept parameter meal and tip in double type and another will accept parameter meal in double but tip in integer. Both of this method are doing the same job which is just printing the total of meal.

In the main program, create a Scanner object and use it to prompt user to input meal price and tip (Line 6-10).  Next call the calculatePrice method for twice. In the first time, pass meal and tip as double type data to calculatePrice method (Line 12). In the second time, pass meal in double but tip in integer to the method. Only the method with parameter list that match the argument data type will be implemented and output the total meal price.  

You might be interested in
Which option in the file menu will open a blank document?
artcher [175]

The answer is click on new

5 0
3 years ago
7. Accepting things that happen without trying to change them is known as
alukav5142 [94]

Answer:

accept people for who they are instead of trying to change them

Explanation:

i don't know if this is right or wrong but i hope this helped you :)

3 0
3 years ago
How do you enter the command prompt on Chromebook
Step2247 [10]

1) Go through the standard Chrome OS login screen (you'll need to setup a network, etc) and get to the web browser. It's OK if you login as guest.

2) Press [ Ctrl ] [ Alt ] [ T ] to get the crosh shell.

3) Use the shell command to get the shell prompt.

3 0
2 years ago
The advent of mobile systems run by Android and other operating systems opens a wide range of new system management and security
sergeinik [125]

Answer:

bring your own devices

Explanation:

"bring your own devices" paradigm is getting popular since organizations are increasingly allowing users to perform work tasks <em>on their own</em> personal devices, It is preferred because of the benefits and ease for the user. On the other hand, this paradigm opens several security risks.

For example processing sensitive data on personal devices creates risks in case of data recovery or if the device is stolen or lost.  

Additionally, <em>control and monitoring</em> of organizational data is harder when users allowed to work on their personal devices. Thus <em>data leakage</em> and <em>public exposure</em> can happen more easily.

7 0
2 years ago
On early computers, every byte of data read or written was handled by the CPU (i.e., there was no DMA). What implications does t
grandymaker [24]

Answer:

Multiprogramming will be extremely difficult to be achieved.

Explanation:

If every byte of data read or written is handled by the CPU the implications this will have for multiprogramming are not going to be satisfactory.

This is because, unlike before, after the successful completion of the input and output process, the CPU of a computer is not entirely free to work on other instructions or processes.

5 0
3 years ago
Other questions:
  • Write an exception class named InvalidTestScore. Modify the TestScores class you wrote in Part I so that it throws an InvalidTes
    10·1 answer
  • In Paint, which of the following are ways to use a picture that you have saved on your computer? (Select all that apply.)
    8·1 answer
  • When a hardware or software interrupt occurs, the CPU calls________
    14·1 answer
  • Which statement accurately describes DTP programs?
    11·1 answer
  • In rolling a die four times, what is the odds that at least one 5 would appear?
    6·1 answer
  • L00000000000000000000000000000000000000000000000000000000l they b00ty tickled
    6·2 answers
  • The ___ function can be entered by clicking the cell where you want to add the funtion such as cell J6. Then click the arrow nex
    6·1 answer
  • Lasses give programmers the ability to define their own types. <br><br> a. True<br> b. False
    10·1 answer
  • Write a short-essay discussing your own stand on social media usage for students.​
    5·1 answer
  • Describe psychographic differences among the past five generations of Americans that you learned about in this course. What type
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!