You found an exciting summer job for five weeks. It pays Php150.00 per hour. Suppose that the total tax you pay on your summer job income is 14%. After receiving your pay, you spend 10% of your net income to buy new clothes and other accessories for the next school year and 1% to buy school supplies. After buying clothes and school supplies, you use 25% of the remaining money to buy savings bonds. For each peso you spend to buy savings bonds, your parents spend Php 0.50 to buy additional savings bonds for you. Write a program that prompts the user to enter the number of hours you worked each week. The program then outputs the following:
Your income before and after taxes from your summer job
The money you spend on clothes and other accessories
The money you spend on school supplies
The money you spend to buy savings bonds
The money your parents added for your savings bonds.
The money left from your income for the week
import java.util.Scanner;
public class Testing {
public void SummerWork(){
Scanner in = new Scanner(System.in);
final double salaryHour = 150.0;
System.out.print("Enter the number of hours you worked each week: ");
int hoursWeek = in.nextInt();
//System.out.println(hours);
double salaryWeek = hoursWeek * salaryHour;
System.out.println("salary before taxes: " + salaryWeek);
salaryWeek -= salaryWeek*0.14;
System.out.println("salary after taxes: " + salaryWeek);
double clothes = salaryWeek*0.1;
System.out.println("The money you spend on clothes and other accessories: " + clothes);
double school = salaryWeek*0.01;
System.out.println("The money you spend on school supplies: " + school);
double bond = salaryWeek*0.25;
System.out.println("The money you spend to buy savings bonds: " + bond);
double bondParents = bond/2;
System.out.println("The money your parents added for your savings bonds: " + bondParents);
salaryWeek -= clothes+school+bond+bondParents;
System.out.println("The money left from your income for the week: " + salaryWeek);
}
public static void main(String[] args) {
Testing objTest = new Testing();
objTest.SummerWork();
}
}
Comments
Leave a comment