Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Broblen anduing in Inn 88sad Problem 1(50ptr) : We wilh to manage the wetithe allowantes for deckos and nuses during the epidenic. We consider the

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Broblen anduing in Inn 88sad Problem 1(50ptr) : We wilh to manage the wetithe allowantes for deckos and nuses during the epidenic. We consider the following classex Seff, Nurse and Doctoc. Yeur job is to defline those claiss as deicribod belew: - Class Staff Anephuas (public) - narinalli (String) - fintNane (Stringi) - lastName (Sering) Mlabads - The geter and senter of the evalfoen atritute - The abaract wethod allow anced setaring a doubte - The mathod sobtring) retumine a string wevesting of autionsind, leat Vare (in uppercase lenew) and firuNane (ougialired) - Class Narse which inherits frum the Stalf class and has the kibowing atructure: Aeritusiss(pablic): - diplotna (Suritg) - Matiarily (imiceen) Meilhods - The anprogriate coestructor ske werked during the latt month - The allewance0) method retarnire : - overlioars"45 if the scniorily is less ithan 10 a malloare*75, etherwise of a nurse irparaicd by lise breals iodicling in, Fint name, tat eare. Biplens, Seniority asd allew antes. - Class Dectar whict iaherits fron the Staff daws and has the fellowing structure: atrituace inolice - ipccialiry (String) - trile (Surisg) - The crostani HoUDa YRATE =Lich ia 230 Meathods: - The appropriale condructor - The allewated methed starming. o (averthours +20) HOURLYRATE if tille is fletw a (ovelleurs +5) HOURLVRATE if tile is AEvidiet a A. cherwise - The methad wStringib scturning a suing eonsitiog of all the informucio Specialiry. Title and allow ance. - Class Test Define the Main mathed and instaneite the claws. struktary: Amphacufeulsi - ipecialiry (iveringa - bithe (Strees) - The ounchast HOURLVRATE which is 220 Mathode - The appovgrase cenatractir - The alles ancor) mothod retarting. (evarllours + 2D) * IHOURLYRNII if tide is detrre o 0, ahkineise Sporialipy. Title asil allerance. - Class Test: Define the Main metbod and intantuate the classes. Problen 2 ( 79,N(s): Create a class PhomoriamberCherker that checks the validiry of a grow phoer Spuin and frgland Dvfine the fedlowing modtwdx: vallater Nubher0 6. fiest alks the uner to incut the covetry to whild the phroe numiter belings Cremanest sely thee cocetres aec apponed). Is case an as isvalid country, the mevage "Thas country ss not supeocted by be aviod if he she woold like so rouy again, if yos, the w hele proece will be repated, if not. the program =ill cait =ieh a Coodlege mecroape. Thon ails the ient to inpor the pituet thambit ant inveles the approgriate valdefice matbod (see briow). If the validative mithod giove number") in dipplyont. Oderwise. If diplays feg. "Tha is a Nates In the following. a phone number in the apgnopriane foemat aith no hyphent (-) is alw valid Phane oonuder this it the RogliX, an arl? - validute Merrecaad thut whosks if the Sering passed ai ats argumone is a static and reteres a Phericiat. - The phone number abould have the folloning foemue: + 21.-5 57 .us- - volidafeSpaainh that checks if the String pumed as an argument is a and reharns a Boclean. valud British plivoe number" or sot siag Regfix. This function is stabic and scturas a IBoolean. * The plocoe number should have the follening foenut; +44-26-13xssxck or 6044.3 Problem solving in Java (80,0ts): Problem 1 ( 50pts) : We wish to manage the overtime allowances for doctors and nurses during the vaccination campaign that was organized to counter the spread of the 'Covid-19' epidemic. We consider the following classes: Staff, Nurse and Doctor. Your job is to define these classes as described below: - Class Staff Altributes (public) - nationalID (String) - firstName (String) - lastName (String) - overHours (private attribute of type integer, initialized to -1) Methods: - The constructor with parameters (nationalID, firstName, lastName) - The getter and setter of the overHours attribute - The abstract method allowance() returning a double - The method toString 0 returning a string consisting of nationalID, lastName (in uppercase letters) and firstName (capitalized) - Class Nurse which inherits from the Staff class and has the following structure: Altributes (public); - diploma (String) - seniority (integer) Methods: - The appropriate constructor - updateOverHours0 that asks the user (nurse) to input the number of hours she worked during the last month. - The allowance() method returning : - overHours*45 if the seniority is less than 10 - overHours*75, otherwise - The method toString 0 returning a string consisting of all the information of a nurse separated by line breaks including ID, First name, Last name, Diploma, Seniority and allowances. - Class Doctor which inherits from the Staff class and has the following structure: Attributes (public): - speciality (String) - title (String) - The constant HOURLYRATE which is 220 Methods: - The appropriate constructor - The allowance() method returning: ( overHours +20) HOURLYRATE if title is Intern (overHours +10 ) * HOURLYRATE if title is Resident (overHours +5) * HOURLYRATE if title is Attending 0 , otherwise - The method toString() returning a string consisting of all the information of a doctor separated by line breaks including ID, First name, Last name, Speciality, Title and allowance. - Class Test: Define the Main method and instantiate the classes

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

Students also viewed these Databases questions