Answer:
Step-by-step 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);
}