Problem # 3 edit

Problem # 3 edit - id = scan.nextLine(); id =...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.Scanner; public class EmployeeDriver { public static void main(String[] args) { double salary; int yearhired, i = 0; String id; String initialName; String data; Boolean keepgoing = true , valid = true; Employee emp[] =new Employee[1000]; while(keepgoing) { valid = true; Scanner scan = new Scanner(System.in); System.out.println("Enter a name for the employee"); initialName = scan.nextLine(); System.out.println("Enter a salary for the employee"); salary = scan.nextDouble(); System.out.println("Enter the year the employee was hired."); yearhired = scan.nextInt(); System.out.println("Enter the identification number for the employee.");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: id = scan.nextLine(); id = scan.nextLine(); emp[i] = new Employee(salary, yearhired, id, initialName); while(valid) { valid = false; System.out.println("Would you like to enter another Employee (y or n). "); data = scan.next(); if(data.equalsIgnoreCase("y")) { keepgoing = true; } else if(data.equalsIgnoreCase("n")) { keepgoing = false; } else { System.out.println("Error: not a valid Entry"); valid = true; } } i++; } i =0; while(emp[i].gethiredate() != 0) { emp[i].writeOutput(); emp[i].writeOutput2(); i++; } } }...
View Full Document

Page1 / 2

Problem # 3 edit - id = scan.nextLine(); id =...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online