0% found this document useful (0 votes)
6 views

The Problem

Uploaded by

reubenklatzer01
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

The Problem

Uploaded by

reubenklatzer01
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

(Create your own classes)

The question:
Create the following application that will determine if a politician is a good politician or not.

The “Politctian” class: [14]


Complete the Politician class as shown in the UML class diagram and description below:

Politician
‐ surname: String
‐ position: String
‐ politicalParty: String
+ Politician()
+ Politician(String, String, String)
+ setSurname(String): void
+ setPosition(String): void
+ setPoliticalParty(String): void
+ getSurname(): String
+ getPosition(): String
+ getPoliticalParty(): String
+ goodPolitician(int, double): boolean

The “Politician” class description:


Member/Method Description Marks
surname Instance variables of the Politician class.
position 2
politicalParty
Politician() The default constructor will initialize the instance variables where surname will be “SURNAME”, position will
2
be “NOT APPOINTED YET”, and politicalParty will be “MUST MAKE UP YOUR MIND”.
Politician(String, String, String) The overloaded constructor will initialize the instance variables to the parameters. 2
setSurname(String) Mutator methods
setPosition(String) 1
setPoliticalParty(String)
getSurname() Accessor methods 1
getPosition()
getPoliticalParty()
goodPolitician(int, double) This method will receive the budget as an int parameter and the money spend by the politician as the second
parameter which is of type double. The method should determine the percentage of the money spend of the 6
budget and then determine of this it is less than 100.

You might also like