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
Soloha48 [4]
3 years ago
7

In this scenario, two friends are eating dinner at a restaurant. The bill comes in the amount of 47.28 dollars. The friends deci

de to split the bill evenly between them, after adding 15% tip for the service. Calculate the tip, the total amount to pay, and each friend's share, then output a message saying "Each person needs to pay: " followed by the resulting number.

Computers and Technology
2 answers:
pickupchik [31]3 years ago
5 0

Answer:

The java program for the given scenario is as follows.

import java.util.*;

import java.lang.*;

public class Main

{

   //variables for bill and tip declared and initialized

   static double bill=47.28, tip=0.15;

   //variables for total bill and share declared

   static double total, share1;

public static void main(String[] args) {

    double total_tip= (bill*tip);

    //total bill computed

    total = bill + total_tip;

    //share of each friend computed

    share1 = total/2;

    System.out.printf("Each person needs to pay: $%.2f", share1);  

}

}

Explanation:

1. The variables to hold the bill and tip percent are declared as double and initialized with the given values.

static double bill=47.28, tip=0.15;

2. The variables to hold the values of total bill amount and total tip are declared as double.

3. All the variables are declared outside main() and at class level, hence declared as static.

4. Inside main(), the values of total tip, total bill and share of each person are computed as shown.

double total_tip= (bill*tip);

total = bill + total_tip;

share1 = total/2;

5. The share of each person is displayed to the user. The value is displayed with only two decimal places which is assured by %.2f format modifier. The number of decimal places required can be changed by changing the number, i.e. 2. This format is used with printf() and not with println() method.

System.out.printf("Each person needs to pay: $%.2f", share1);  

6. The program is not designed to take any user input.

7. The program can be tested for any value of bill and tip percent.

8. The whole code is put inside a class since java is a purely object-oriented language.

9. Only variables can be declared outside method, the logic is put inside a method in a purely object-oriented language.

10. As shown, the logic is put inside the main() method and only variables are declared outside the method.

11. Due to simplicity, the program consists of only one class.

12. The output is attached.

Sergio039 [100]3 years ago
5 0

Answer:

bill =  47.28

tip = bill *.15

total = bill + tip

share = total

print( "Each person needs to pay: "+str(share) )

Explanation:

You might be interested in
Which function can you perform on a word processor but not on a typewriter?
AnnZ [28]
Deleting a character when you make a mistake and the print it without errors
4 0
3 years ago
Add my epic games account "Lil Carr OXB" and if that not work, then "swish4444"
Andrew [12]

Answer:

-_________________________________-

Explanation:

-__________________________________________________________-

3 0
3 years ago
Read 2 more answers
In python how do you write for prime factors
olasank [31]

Answer:

The while loop is used and the factors of the integer are computed by using the modulus operator and checking if the remainder of the number divided by i is 0. 3. Then the factors of the integer are then again checked if the factor is prime or not.

Explanation:

google

4 0
3 years ago
Smartphones use ________ technology, allowing users to perform several functions with one device. group of answer choices embedd
12345 [234]

Smartphones use <u>convergence or integration</u> technology, allowing users to perform several functions with one device.

<h3>What are smartphones?</h3>

Smartphones can be defined as hybrid versions of mobile devices that are designed and developed to have more features, so as to enable them run different software applications, functions and perform tasks with the aid of software applications such as web browsers, multimedia player, etc.

<h3>Types of smartphones.</h3>

In Computer technology, there are three popular types of mobile devices and these include the following:

  • Handheld computers
  • Personal digital assistants (PDAs)
  • Smartphones.

In Computer technology, smartphones are designed and developed to use <u>convergence or integration</u> technology by combining previously unrelated technologies together, in order to allow end users perform several functions with one device.

Read more on smart phones here: brainly.com/question/15867542

#SPJ1

8 0
2 years ago
Which editing options are available when making a custom show?
IRISSAK [1]

adding slide, removing slide, and changing order of slides


8 0
3 years ago
Other questions:
  • Make a program that (i) asks the user for a temperature in Fahrenheit degrees and reads the number; (ii) computes the correspond
    8·1 answer
  • What did the Lorax mean when he said i speak for the trees
    11·1 answer
  • Privacy settings allow account owners to decide who can ........
    12·2 answers
  • What can Strings store
    15·2 answers
  • What is a slide master ?
    8·2 answers
  • Callie Crystal owns and operates one of the most successful local coffee shops in Denver, called The Edgewater Café. Each time a
    5·2 answers
  • What does "CPU" stand for?
    15·2 answers
  • Can somebody help me out
    15·1 answer
  • Assuming that s and t are Strings, which of the following code fragments are such that the value returned by s.indexOf( t ) befo
    6·1 answer
  • What is E-Commerce? Answer The Following. Pls Help Me​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!