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
26. A network administrator is looking to expand the available bandwidth of his extranet remote branch by adding another leased
Talja [164]

The option that will realize the above case is that  Add a distribution layer card into the router allowing another gigabit ethernet port.

<h3>How do one  Increase Bandwidth on Router</h3>

The steps are:

  • Alter the Router's Location.
  • Then Reboot your Router.
  • Have a Dual-bandwidth Router.
  • Then do Update the Router's Firmware.

So therefore, The option that will realize the above case is that  Add a distribution layer card into the router allowing another gigabit ethernet port.

Learn more about expanding bandwidth from

brainly.com/question/25898149

#SPJ1

5 0
2 years ago
File encryption is the science of writing the contents of a file in a secret code. Your encryption program should work like a fi
Stolb23 [73]

Answer:idk

Explanation:

Ifk

7 0
4 years ago
Client/server networks are controlled by a central server that runs specialized software called a(n) ________.
zlopas [31]

The answer to this question is a network operating system. A network operating system or NOS is a computer operating system that supports the computers when it is connected on a local area network and it also helps in sharing data and information in other computers thru a network.  

8 0
3 years ago
Identify one or more negative and positive impacts of electricity.
shepuryov [24]

Answer:

positive results is the use of light to see

negative results is high power supply cause burning of things and make houses to burn

Explanation:

pls make me ur brainliest

5 0
3 years ago
Which type of intrusion detection may terminate processes or redirect traffic upon detection of a possible intrusion?
katen-ka-za [31]

The process of intrusion detection includes monitoring and analyzing the network activity and data for potential vulnerabilities and attacks.

The active type of intrusion detection may terminate processes or redirect traffic upon detection of a possible intrusion.

The active IDS is known as an intrusion prevention system — IPS.  It automatically blocks suspected attacks in progress without any intervention required by an operator.

5 0
3 years ago
Other questions:
  • Create the strAnalysis() function that takes 1 string argument and returns a string message. The message will be an analysis of
    15·1 answer
  • Edhesive 7.1 question 2
    6·1 answer
  • What does the shell of an operating system do
    14·1 answer
  • If some1 emails u and u want to know who it was how do u find that out
    10·2 answers
  • Provide the definition for each of the following structures and unions:
    8·1 answer
  • Complete the second clause of the following Prolog program for member/2 where member(X, Y) checks whether X is an element (a mem
    7·1 answer
  • What allows a programmer to write code quickly and efficiently for an action that must be repeated?
    5·2 answers
  • 2) A simple operating system supports only a single directory but allows it to have arbitrarily many files with arbitrarily long
    7·1 answer
  • When you create names for the elements of a webpage (such as ), what are some rules that you can follow to make your HTML code e
    13·2 answers
  • Can someone pls do a toradora,Mha or princess jellyfish rp I'm open for anyother rp's
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!