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

Write a Java program that prompts the user for the name of the employee, the hou

ID: 644564 • Letter: W

Question

Write a Java program that prompts the user for the name of the employee, the hourly rate, and the number of hours worked and prints the pay check

Example(1):

Input:

Enter the first name of the employee:
John
Enter the last name of the employee:
Doe
Enter the hourly rate:
14.50
Enter the hours worked:
38

Output:

Acme Corp                    Big Bank               Check Number: 1234
123 St.                    321 Small St.              
Big City, NY 012345           Small City, AK 543210              
                                        Date:       Amount:
                                        04/29/09   $***551.00
PAY
FIVE HUNDRED FIFTY ONE 0 / 100 ***************************************************************************
TO THE ORDER OF:
                        John Doe
                        124 Fake Rd
                        Small Town, NK 43251 ___________________
                                                  ___________________
                    |:478108240|: 200620375"* 1301

Example(2):

Input:

Enter the first name of the employee:
Sam
Enter the last name of the employee:
Jones
Enter the hourly rate:
14.50
Enter the hours worked:
45

Output:

Acme Corp                    Big Bank               Check Number: 1234
123 St.                    321 Small St.              
Big City, NY 012345           Small City, AK 543210              
                                        Date:       Amount:
                                        04/29/09   $***688.75
PAY
SIX HUNDRED EIGHTY EIGHT 75 / 100 ************************************************************************
TO THE ORDER OF:
                        Sam Jones
                        124 Fake Rd
                        Small Town, NK 43251 ___________________
                                                ___________________
                    |:478108240|: 200620375"* 1301

Explanation / Answer

import java.util.*;

public class ScannerDemo {
public void pw(int n,String ch)
{
String one[]={" "," one"," two"," three"," four"," five"," six"," seven"," eight"," Nine"," ten"," eleven"," twelve"," thirteen"," fourteen","fifteen"," sixteen"," seventeen"," eighteen"," nineteen"};

String ten[]={" "," "," twenty"," thirty"," forty"," fifty"," sixty","seventy"," eighty"," ninety"};

if(n>19) { System.out.print(ten[n/10]+" "+one[n%10]);} else { System.out.print(one[n]);}
if(n>0)System.out.print(ch);
}

  
  

public static void main(String[] args) {

int number;

// create a new scanner with the specified String Object
Scanner scanner = new Scanner(System.in);

// find the next token and print it
System.out.println("Enter the first name of the employee:");
String name=scanner.nextLine();
  
System.out.println ("Enter the last name of the employee: ");
String last=scanner.nextLine();
  

System.out.println("Enter the hourly rate:");
number =scanner.nextInt();

System.out.println("Enter the hours worked:");
int number1 =scanner.nextInt();
// n = scanf.nextInt();
int n=number*number1;

  
System.out.println(" Acme Corp Big Bank Check Number: 1234123 St. 321 Small St. Big City, NY 012345 Small City, AK 543210 Date: Amount: 04/29/09 $***"+n+"PAY");
if(n<=0)
System.out.println("Enter numbers greater than 0");
else
{
ScannerDemo a = new ScannerDemo();
a.pw((n/1000000000)," Hundred");
a.pw((n/10000000)%100," crore");
a.pw(((n/100000)%100)," lakh");
a.pw(((n/1000)%100)," thousand");
a.pw(((n/100)%10)," hundred");
a.pw((n%100)," ");
}

System.out.println(" ***************************************************************************");
System.out.println(" TO THE ORDER OF: John Doe 124 Fake Rd Small Town, NK 43251 ___________________");
System.out.println(" ___________________");

// close the scanner
scanner.close();
}
}

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