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
Barry discovers that an attacker is running an access point in a building adjacent to his company. The access point is broadcast
qwelly [4]

Answer: Option (A) is correct

Explanation:

Evil twin is known as a fraudulent point of access in a Wi-Fi which tends to  appear to be honest and legitimate but is known as a set up to oversee on the wireless communications. Evil twin is referred to as the WLAN equal of a phishing scam.  This kind of attack is mostly used in order to steal passwords of an unsuspecting users, that is done either by by phishing or by monitoring the connection, this mostly involves developing a fake web site and thus luring people.

8 0
3 years ago
List 2 end to end test commands. <br><br> Will mark Brainliest!!
Delvig [45]

Answer:

ibm pll

Explanation:

4 0
3 years ago
A third party intercepting a packet and downloading its information before it is sent onward toward its destination is called
SSSSS [86.1K]

Answer:

Explanation:

<u>Packet sniffing</u> is the process of capturing each packet that is transmitted over the network and analyzing its content. Most of the time, packet sniffing is used to troubleshoot network problems or to gather network statistics. The software or device used for capturing packet data is called packet sniffer, packet analyzer, network sniffer or simply network analyzer.

The Packet Sniffer Sensor monitors, among other things:

• Total traffic

• Port sniffer

• Web traffic (HTTP, HTTPS)

• Mail traffic (IMAP, POP3, SMTP)

• File transfer traffic (FTP, P2P)

• Infrastructure traffic (DHCP, DNS, ICMP, SNMP)

• Remote control (RDP, SSH, VNC)

• Other UDP and TCP traffic

Third party intercepting a packet and downloading it information before it is sent onward toward its destination is called <u>Packet Sniffer</u>

4 0
3 years ago
Write a calculator program that keeps track of a subtotal like real calculators do. Start by asking the user for an initial numb
Taya2010 [7]

Answer:

num1 = float(input("Enter the first number: "))

while True:

   print("Add, Subtract, Multiply, Divide, or Quit ?")

   choice = input("Your choice is: ")

   if choice == "Quit":

       break

   num2 = float(input("Enter the second number: "))

   if choice == "Add":

       num1 += + num2

       print("The subtotal is: " + str(num1))

   elif choice == "Subtract":

       num1 -= num2

       print("The subtotal is: " + str(num1))

   elif choice == "Multiply":

       num1 *= num2

       print("The subtotal is: " + str(num1))

   elif choice == "Divide":

       num1 /= num2

       print("The subtotal is: " + str(num1))

print("The final result is: " + str(num1))

Explanation:

Ask the user for the first number

Create a while loop that iterates until specified condition occurs inside the loop

Ask the user for the operation or quitting

If the user chooses quitting, stop the loop. Otherwise, get the second number, perform the operation and print the subtotal

When the loop is done, the user enters Quit, print the final value result

8 0
3 years ago
PLEASE HELP WHATS THE ANSWER
Mkey [24]

Answer:

C

Explanation:

A ends the whole html stuff

B starts a link

D is just the file extension for html files

4 0
3 years ago
Read 2 more answers
Other questions:
  • If the wrong server edition is installed, what command can be used to change to a different edition?​
    5·1 answer
  • What does nat stand for? network access trigger network administration timetable network address translation network association
    13·1 answer
  • Who is father of computer <br>​
    8·1 answer
  • a traditional wireless network involving access points that all have wired connections is known as a ?​
    5·1 answer
  • When shopping on the web, it is better to pay for your purchase with a debit card rather than a credit card.
    10·2 answers
  • Why would a network administrator want to filter certain ports when capturing data such as FTP traffic
    6·1 answer
  • Write a police description a person who know you well​
    12·1 answer
  • When the condition of an if statement is false, the computer will return an error message to the user.
    15·2 answers
  • The names of the governing body or organizationds that creates rules for information technology and information communication te
    9·1 answer
  • Let G = (V, E) be an undirected graph. Design algorithms for the following (in each
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!