Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java SE 1. Design a program to calculate a parttime worker\'s year income 2. The

ID: 3811399 • Letter: J

Question

Java SE

1.   Design a program to calculate a parttime worker's year income

   2.   The program accepts these data from keyboard:

       (1) enter name of the worker

       (2) per hour rate in dollars & cents

       (3) number of hours worked in every week

       (4) number of weeks worked in the year

   3.   Calculate total year income and O/P the calculated results

           in the following format:

           Calculate Year Income of a parttime worker

           ==========================================

           Name:   xxxxxxxx

           Hour rate:   xx.xx

           Weekly hours worked:   xx

           Number of weeks worked:   xx

           Total amount of the year:   xxxxx.xx

           End of Job

*/

import java.util.Scanner;

public class YearIncome

{   public static void main ( String[] args)

   {   Scanner k = new Scanner (System.in);

       String title =   "Calculate Year Income of a parttime worker"

                       + " ==========================================";

       String name;   //name of worker

       double hRate;   //hour rate

       int wHrs;       //weekly hours worked

       int tWks;       //total weeks worked in the year

       double totalAmt;//total amount of year income

      

       System.out.println ( title );       //disp title of program

       System.out.print ( "Enter name: " );           name = k.nextLine();

       System.out.print ( "Enter hour rate: " );       hRate = k.nextDouble();

       System.out.print ( "Enter weekly hours: " );   wHrs = k.nextInt();

       System.out.print ( "Enter total weeks: " );       tWks = k.nextInt();

      

       totalAmt = hRate * wHrs * tWks;       //multiply rate,hrs,weeks to get ans

       System.out.println ( title );       //disp title of program

       System.out.print ( "Name: " + name

                       + " Hour rate: " + hRate

                       + " Weekly hours worked: " + wHrs

                       + " Number of weeks worked: " + tWks

                       + " Total amount of the year: " + totalAmt

                       + " End of Job"   );

   }

}

      

Explanation / Answer

SOURCE CODE:-

import java.util.Scanner;

public class YearIncome

{   public static void main ( String[] args)

   {   Scanner k = new Scanner (System.in);

       String title =   "Calculate Year Income of a part-time worker"+" ";

       String name;   //name of worker

       double hRate;   //hour rate

       int wHrs;       //weekly hours worked

       int tWks;       //total weeks worked in the year

       double totalAmt;//total amount of year income

double wh, tw;

      

       System.out.println ( title );       //disp title of program

       System.out.print ( "Enter name: " );          

name = k.nextLine();

       System.out.print ( "Enter hour rate: " );      

hRate = k.nextDouble();

       System.out.print ( "Enter weekly hours: " );

wHrs = k.nextInt();

       System.out.print ( "Enter total weeks: " );

tWks = k.nextInt();

wh=(double) wHrs;

tw=(double) tWks;

       totalAmt = hRate * wh * tw * 7 ;

       System.out.println ( title );       //disp title of program

       System.out.print ( "Name: " + name

                       + " Hour rate: " + hRate

                       + " Weekly hours worked: " + wHrs

                       + " Number of weeks worked: " + tWks

                       + " Total amount of the year: " + totalAmt

                       + " End of Job"   );

   }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote