In Java.
Use the concept of LOOPS:
2.Write a program that calculates the amount a person would earn over a period of time if his
or her salary is one penny the first day, two pennies the second day, and continues to double
each day. The program should display a table showing the salary for each day, and then
show the total pay at the end of the period. The output should be displayed in a dollar
amount, not the number of pennies.
Input Validation: Do not accept a number less than 1 for the number of days worked.
Programme Code:
import javax.swing.JOptionPane;
public class PenniesForPay
{
public static void main(String[] args)
{
String inputString;
int pennies; // Penny accumulator
int totalPay; // Total pay accumulator
int maxDays; // Max number of days
int day; // Day counter
inputString = JOptionPane.showInputDialog("For how many days will you work? ");;
maxDays = Integer.parseInt(inputString);
// Validate the input
while (maxDays < 1){
inputString = JOptionPane.showInputDialog("The number of days " + "must be at least 1.\nEnter the number of days: ");
maxDays = Integer.parseInt(inputString);
}
day = 1;
pennies = 1;
totalPay = 0;
while (day <= maxDays)
{
// Display the day number and pennies earned.
JOptionPane.showMessageDialog(null, "Day:\t" + day + "\nPennies Earned:\t" + pennies);
// Accumulate the total pay.
totalPay = totalPay + pennies;
// Increment for the next day.
day++;
// Double the number of pennies.
pennies = pennies * 2;
}
JOptionPane.showMessageDialog(null, "Total pay: $" + totalPay / 100.0);
}
}
Out Put : I take 3 Days.

For Day 1:

For Day 2:

For Day 3:

Total Earned Money:

This Way You can Solve this . I used Blue J Compiler to Solve this.
In Java. Use the concept of LOOPS: 2.Write a program that calculates the amount a person...
Write a program using Python that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should ask the user for the number of days. Display a table showing what the salary was for each day, then show the total pay at the end of the period. The output should be displayed...
Using Javascript! Write a program that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should ask the user for the number of days. Display a table showing what the salary was for each day, and then show the total pay at the end of the period. The output should be...
Python Computer Programming Write a program that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should ask the user for the number of days. Display a table showing what the salary was for each day, then show the total pay at the end of the period. The output should be...
Write a program that calculates the amount a person would earn over a 30-day period of time if his/her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should display a table showing the salary for each day, and then show the total pay at the end of the period. The output should be displayed in a dollar amount, not the number of pennies. A sample output might look...
HTML only Design and implement a program that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should:ask the user for the number of daysdisplay a table showing what the salary was for each daythen show the total pay at the end of the period.The output should be displayed in the...
In 80x86 assembly language Write a program that calculates how much a person earns in a month if the salary is one penny the first day, two pennies the second day, four pennies the third day, and so on with the daily pay doubling each day the employee works. The program should ask the user for the number of days the employee worked during the month, validate that it is between 1 and 31, and then display a table showing...
Write a Java program that calculates how much a person would earn after a period of time, according to the following rules: 1. The starting salary for the first day is $1. 2. The salary will double each day. Ask the user to input the number of days worked. The output should display how much the salary was for each day worked, and show the total pay at the end of the work period. Get output similar to the sample...
Week 5 Project Write a program that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, four pennies the third day, and continues to double each day. Output the amount earned each day .. and the total pay at the end. The Algorithm (Plan) for your program would be: Ask the user for the number of days to be...
In Python. Write a program that will calculate the amount of money a person would earn over a period of time if his/her salary is one penny the first day and two pennies for the second day, and continue to double each day. Hints: Declare variables Get the number of days from the user. Show the salary table for each day 4. Use ‘for loop’ to loop through the range of days (1, num_days +1) 5. Display the total pay...
Project 5 - intro to python Write a program in python that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, four pennies the third day, and continues to double each day. Output the amount earned each day .. and the total pay at the end. The Algorithm (Plan) for your program would be: Ask the user for the...