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]
2 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]2 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
An important task that the operating system performs is ____, which keeps track of the files stored on a computer so that they c
finlep [7]
#1) An important task that the operating system performs is ____, which keeps track of the files stored on a computer so that they can be retrieved when needed.
Answer: File Management System. Keeps track of where files are stored and determines how the files are stored following the operating system file allocation policies. It uses available storage space efficiently for files and creates a record/log of all file usage. It allocates a file to a user if is free, and if they are permitted access to it. Then de-allocates file when the user is finished with it.
8 0
3 years ago
I am trying to make a flowgorithm chart for a dogs name, age, weight and when their weight is less than 50 OR more than 100 its
kumpel [21]

Answer:

i think it helps

Explanation:

sorry there was someone else rude as heck messaging and responding I couldn't see their screen name

what isig naame

oh okay

I have sent dm

i dont know your name there

5 0
2 years ago
how to create use an array of Course objects instead of individual objects like course 1, course 2, etc
AURORKA [14]

Answer:

To save the course object instances in an array, use;

Course[] courses = new Course[7];

courses[0] = new Course("IT 145");

courses[1] = new Course("IT 200");

courses[2] = new Course("IT 201");

courses[3] = new Course("IT 270");

courses[4] = new Course("IT 315");

courses[5] = new Course("IT 328");

courses[6] = new Course("IT 330");

Explanation:

The java statement above assigns an array of size 7 with the course class constructor, then order courses are assigned to the respective indexes of the new array.

3 0
3 years ago
In computer science how can you define "copyright, designs and patents act 1988"?​
Natali5045456 [20]

Answer:

:)

Explanation:

Copyright Designs and Patents Act

The Copyright Designs and Patents Act (1988) gives creators of digital media the rights to control how their work is used and distributed. ...

Anything which you design or code is automatically copyrighted and may not be copied without your permission, as the digital creator.

5 0
2 years ago
A marketing firm has been hired to help a client understand how their online brand is perceived. The firm has set up a system to
KiRa [710]

Answer:

Automated Reasoning

Explanation:

Automated reasoning is a type of Natural language understanding(NLP) in computer science that makes logical inferences based on information or data previously gathered. Automated reasoning allows computers make intelligent decisions and reason logically based on data gathered. For example, a system is based to scan online reviews and conclude on the ones that are negative reactions based on previous data.

3 0
3 years ago
Other questions:
  • Which button would you use to quickly add addresses to a mail merge envelope?
    5·1 answer
  • What is the different between image processing and machine vision? Please explain with an example.
    11·1 answer
  • In C, developers may access arrays via bracketed syntax like Java or by using * dereferencing notation. The following assignment
    5·1 answer
  • What is a VIN and what role does it play during a criminal investigation? Explain how a VIN could help in a bomb and/or arson ca
    12·1 answer
  • Select the correct word to complete the sentence
    11·2 answers
  • Tennis players are not allowed to swear when they are playing in Wimbledon
    6·2 answers
  • What are the differences between Cc &amp; Bcc in emails that are sent ?​
    8·2 answers
  • What can you think of as a box or container that holds a value and has a label?
    11·2 answers
  • Draw a flow chart to access the marks of three students. calculate the total avarage and display the result​
    11·1 answer
  • What type of e-mail typically lures users to sites or asks for sensitive information?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!