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
OleMash [197]
3 years ago
11

Write a program that calculates the cost of a phone call. The user enters a positive integer that

Computers and Technology
1 answer:
san4es73 [151]3 years ago
5 0
Add the following constants in the class definition, before the main method:

    private final static float START_COST = 1.5f;
    private final static float HIGH_TARIFF = 0.5f;
    private final static float LOW_TARIFF = 0.25f;
    private final static int FIXED_MINS = 2;
    private final static int HIGH_TARIFF_MINS = 10;

Then add this to the main method you already had:

        float price = START_COST;
        if (x > FIXED_MINS) {
            if (x <= HIGH_TARIFF_MINS) {
                price += HIGH_TARIFF*(x-FIXED_MINS);
            }
            else {
                price += HIGH_TARIFF*(HIGH_TARIFF_MINS-FIXED_MINS) 
                    + LOW_TARIFF*(x-HIGH_TARIFF_MINS);
            }
        }   
        System.out.printf("A %d minute call costs %.2f", x, price);      

You might be interested in
Which tool will be useful in darkening a subject’s hair color in a photograph? A.Dodge tool B.Burn tool C.Patch tool D.Blur tool
choli [55]
It's B. The burn tool darkens stuff. The dodge tool lightens stuff. hope this helps, have an amazing day :)
8 0
4 years ago
Read 2 more answers
How can I get multiple user inputs in Java ? I want to be able to use it for subtraction, addition,division and multiplication.F
Evgesh-ka [11]
You can do something like this :

Scanner sc = new Scanner(System.in);
int[] nums = new int[4];

for(int i = 0; i < nums.length; i++) {
System.out.println("Enter next number: ");
nums[i] = sc.nextInt();
7 0
2 years ago
Which of the following is NOT a project management cause of failed projects? (Points : 2) Shortcuts taken during the project
muminat

Answer:

Inadequate analysis of system and the design

Explanation:

Some of the causes of failed project in project management are as follows:

  • Deficient hazard the executives.
  • Inadequately characterized task scope.  
  • Inability to recognize key presumptions.  
  • Undertaking administrators who need involvement and preparing.
  • Absence of powerful correspondence at all levels.
  • No utilization of formal techniques and procedures.  
  • Overrun of the budget

8 0
4 years ago
What type of stone was the most common building material of royal pyramid?
eimsori [14]
I think it's low grade lime stone..
6 0
3 years ago
Henry conducted a survey on an ad done by his company. In the survey, he asked people to evaluate the ad and state whether they
Llana [10]
The answer is (C) Rating scale test

These are set of categories designed to get a response from set information about a qualitative or a quantitative attribute. Common examples include a 1-10 rating scale or the Likert response scale. One is required to select a number or an option considered to reflect the perceived quality of something, say a product.






4 0
4 years ago
Other questions:
  • In Linux Operating System, what file extension is used forexecutable files?
    6·1 answer
  • One problem with using e-mail is that ______. a. It can be perceived as being too casual b. It is never appropriate for business
    12·1 answer
  • When you select a state abbreviation from a combo box, how does the form control record your selection?
    8·1 answer
  • A dual-core processor is like having two processors in one.<br> -True<br> -False
    6·1 answer
  • How does sugar dissolve in water ? &amp; Read Carefully ?
    9·1 answer
  • In order to create a multi-line comment, what symbol do you use?
    14·1 answer
  • Identify which statement explains why a programmer would break a logic problem into steps.
    13·2 answers
  • The early success of Microsoft was cemented by the release of which software product:
    12·1 answer
  • The ________ is specifically designed for situations requiring a counter variable to control the number of times a loop iterates
    8·1 answer
  • The analysis of attempting to solve a problem with information systems is called ________.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!