CIS 254 Intro to Object Oriented Program Design

Project 4.2

Write a program to display a message telling the educational level of a student based on their number of years of school. The user should enter a number indicating the number of years of school, and the program should then print the corresponding message given below.

Be sure to use named constants rather than any numbers other than 0 in this program.

  if years of school is     the message should be  
less than 0 years of school must be a non-negative integer
0 no school
1 - 6 elementary school
7 - 8 middle school
9 - 12 high school
> 12 college

Note: there is no reason to use || or && in this project. If you use them, you will lose points for unnecessarily complex code.

Sample screen output 1:

Enter number of years of school: 7
middle school

Sample screen output 2:

Enter number of years of school: -4
years of school must be a non-negative integer