import java.util.Scanner; import java.text.DecimalFormat; public class PenniesFo
ID: 3649558 • Letter: I
Question
import java.util.Scanner;import java.text.DecimalFormat;
public class PenniesForPay
{
public static void main(String[] args)
{
int pennies; // Penny accumulator
int totalPay; // Total pay accumulator
int maxDays; // Max number of days
int day; // Day counter
// Create a Scanner object for keyboard input.
Scanner keyboard = new Scanner(System.in);
//step1: ask the user to enter the number of days he/she worked. and store the input in the variable maxDays
//step2: Assign the variable day to 1.
//step3: Assign the variable pennies to 1
//step4: Initialize the variable totalPay to 0.
// Display the report header.
System.out.println("Day Pennies Earned");
// Write a while loop to calculate and print the salary for each day.
//step5: fill the condition in the while loop
while ( )
{
// Display the day number and pennies earned.
System.out.println(day + " " + pennies);
//step6: add the earned pennies to totalPal.
//step7: Increment day by one.
//step8: Double the number of pennies
}
// Create a DecimalFormat object to format output.
DecimalFormat dollar = new DecimalFormat("#,##0.00");
// Display the total pay.
System.out.println("Total pay: $" +
dollar.format(totalPay / 100.0));
}
}