Skip to content

Class-CS111/l19-console-input-with-validation-abello62

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open in Codespaces

Lab 19: Console Input With Validation

Overview:

You recently made your own classes from scratch and added validity checking in your setter methods. In this lab, you will create an array of two NetflixOriginal objects by getting valid inputs from the user.

Step 1:

  • Write a method instantiateFromInput() that takes a Scanner object as a parameter and returns a NetflixOriginal object.
  • Inside the method, prompt user to input name, starRating and genre. Set starRating and genre only when the inputs are valid. Keep asking the user to enter starRating and genre until they are valid.

Step 2:

  • Inside the main() method, create an array of NetflixOriginal shows of size 2. Instantiate those two objects by calling the instantiateFromInput() method.

  • Finally, output the shows. Your output should look like:

    Please enter the name of the show: Atypical Please enter the star rating: 4.5 Please enter the genre: drama Atypical,4.5,drama Please enter the name of the show: Stranger Things Please enter the star rating: 5.0 Please enter the genre: science fiction Stranger Things,5.0,science fiction

About

class-cs111-classroom-3033-l19-console-input-with-validation-L19-Console-Input-with-Validation created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 93.2%
  • Shell 6.8%