Problem

Complete the following StudentIdDriver class skeleton by replacing all six occurrences of ...

Complete the following 

StudentIdDriver
 class skeleton by replacing all six occurrences of  with your own code such that the program operates properly. For details, read the comments above or next to the  insertions. Note the 
StudentId
 class, which is below the 
StudentIdDriver
 class. The two classes are in separate files.

import java.util.Scanner;public class StudentIdDriver{ public static void main(String[] args) {  Scanner stdIn = new Scanner(System.in);  StudentId student;  String name;  // Instantiate a Studentld object and assign it to student.

 

  System.out.print(“Enter student name: “);  name = stdIn.nextLine( );    // Assign name to the student object.

  System.out.print(“Enter student id: “);  // In a single line, read an int for the id value,  // and assign it to the student object.

// If invalid id, execute the loop.  // (Use the isValid method in the while loop condition.)  while ()

{   System.out.print(“Invalid student id - reenter: “);   // In a single line, read an int for the id value   // and assign it to the student object.

   

}  System.out.println(“\n” + name +   “, your new e-mail account is: \n” + 

     // Get email account. } // end main} // end class StudentIdDriverpublic class StudentId{ private String name; private int id;

//********************************************************* public void setName(String n) { this.name = n; } public String getName() { return this.name; } public void setId(int id) { this.id = id; } public int getId() { return this.id; } //********************************************************* public String getEmailAccount() { // Include ““ in concatenation to convert to strings. return ““ + this.name.charAt(0) + this.id + “@pirate.park.edu”; } //********************************************************* public boolean isValid() { return this.id >= 100000 && this.id <= 999999; }} // end class StudentId

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 6
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT