- First Name
- Last Name
- Street Address
- City
- State - 2 digits in length
- Zip - Integer 4 digits in length (minimum and maximum)
- GPA (from 0.0 to 4.0)
- Major - String
- Teacher Class - overrides the student class
The main class should
- Instantiate the student class and prompt the user to enter each of these properties
- Print out the data from the instantiated class.
- Instantiate the teacher class.
- Print out the data from the instantiated class.
I'm new to Kotlin but this is what I have so far. How do I prompt the user for each data point, get their input for each, and then print the user input out as a whole once all info is entered
Ideal output
- First Name: ...
- Last Name: ...
Then once all info is entered it prints the entirety of the info entered by user with prompts.
open class Student(first: String, last: String, street: String, city: String, state: String, zip: Int, gpa: Int, major: String)
{
var firstName : String?= first
var lastName : String?= last
var streetAddress: Int?= street
var city: String?= city
var state : String?=state
var zip:Int?=zip
var gpa: Int?=gpa
var major: String?=major
}
class Teacher (first: String):Student (first)
fun main() {