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
cupoosta [38]
3 years ago
11

If apples are currently $4.99 a dozen, create a program that will determine the cost of any number of apples. Make the cost of a

dozen apples a variable as well, so that it can easily be changed if the price of apples changes.
Computers and Technology
1 answer:
CaHeK987 [17]3 years ago
7 0

Answer:

Explanation:

The following code is written in Java, it takes the cost of a dozen apples as a variable (costPerDozen), it then asks the user for the total number of apples that is places in a variable called (numberOfApples). It then calculates the total cost of the apples by dividing the costPerDozen by 12 and then multiplying by the total nuumber of apples requested. Finally it prints out the total.

 public static void main(String[] args) {

       double costPerDozen = 4.99;

       Scanner input = new Scanner(System.in);

       System.out.println("How many apples would you want?");

       int numberOfApples = input.nextInt();

       double totalCost = (costPerDozen / 12) * numberOfApples;

       System.out.println("That will cost: " + totalCost);

   }

You might be interested in
if a user has one column in a table and would like to make it into two columns which command should be used
BlackZzzverrR [31]
Don't know asdfghjklpoiuytrewqzxcvbnm,
4 0
3 years ago
In which program structure does the processor verify the mentioned condition only after executing the dependent statements once?
Cloud [144]
B. because you have to do it while in structure.
3 0
3 years ago
Read 2 more answers
Which shortcut keys can be used to duplicate a slide?
Leya [2.2K]

Answer:

Ctrl + D used to duplicate a slide

8 0
3 years ago
Which skill type refers to the knowledge and ability to perform a task?
Thepotemich [5.8K]

Sound, Audio for engineering sound Quality's.

7 0
3 years ago
Read 2 more answers
A web designer is creating a web site and wants each browser to resize the text size to look the same in each device. what measu
adelina 88 [10]
The designer could use the measurements in pixels. 
4 0
3 years ago
Other questions:
  • Two different names that refer to the same data item best defines:
    12·1 answer
  • Each webpage is assigned a(n) ______, an address that identifies the location of the page on the Internet.
    6·1 answer
  • Allison’s computer is displaying a strange error message saying that Allison, who is an administrator, does not have access to a
    15·1 answer
  • Why computer manufacturers constantly releasing faster computers ?
    14·1 answer
  • 15 _____ 3 = 0 Question 11 options: a) / b) % c) * d) //
    12·1 answer
  • Which characteristics support an agile mis infrastructure?
    6·1 answer
  • Tom is not sure how to code contents such as title and meta elements. These are coded as ____ elements.
    8·2 answers
  • Write a pseudocode for the logic of a program that accepts five numbers from a user and displays one of the following messages:-
    8·1 answer
  • What is e banking effects
    7·1 answer
  • in ____ structures, the computer repeats particular statements a certain number of times depending on some condition(s).
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!