Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

User A college department needs a system for obtaining total hours for all the peopleinvolved in its program. They have a record of all the

User
A college department needs a system for obtaining total hours for all the peopleinvolved in its program. They have a record of all the professors, teaching assistantsand students with the name of the course and total hours for each course following thispattern:Professor Isaac Newton Physics 6TA Marie Curie Physics 6Professor Isaac Newton Calculus 4Student Amy Adams Calculus 4Student Will Smith Calculus 4Student Brad Pitt Physics 6Student Will Smith Physics 6Professor Dmitri Mendeleev Chemistry 6TA Carl Gauss Calculus 4Student Amy Adams Economics 3Professor Adam Smith Economics 3TA Marie Curie Chemistry 6Student Brad Pitt Chemistry 6Student Will Smith Chemistry 6endOut of all hours for each course, the professor attends only lecture hours, TA conductslab hours and students must attend all hours.The number of lab and lecture hours is based on the total hours of the course:if course hours >4 then lab hours =2, otherwise lab hours =1lecture hours = course hours lab hours.Therefore, in the following scenario:Professor Isaac Newton Physics 6TA Marie Curie Physics 6Student Brad Pitt Physics 6the professor has 4 hours, TA has 2, and the student has all 6.
Write a program using abstract classes to represent people and a proper classhierarchy to represent professors, TAs and students. The program should scan the fullrecord above from standard input all at once (do NOT prompt the user to enter eachline or data piece separately and do not hard code the record) and produce a printout ofall the people with their total hours through the use of polymorphism. Every person mustbe mentioned in the printout only once. The printout should be of the following format:Title (Professor/TA/Student) FirstName LastName TotalHoursDo not use ArrayList or any other Java Collections class.Note, there are tabs in the record above, make sure to use regular expression \\s+ insplit method or as a delimiter in Scanner object:String[] tokens = line.splite("\\s+");

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago