[Solved] CSE271-Lab 3-Implement a class Address,a VotingMachine class and a class Student

$25

File Name: CSE271-Lab_3-Implement_a_class_Address,a_VotingMachine_class_and_a_class_Student.zip
File Size: 753.6 KB

SKU: [Solved] CSE271-Lab 3-Implement a class Address,a VotingMachine class and a class Student Category: Tag:
5/5 - (1 vote)

Implement a class Address. (1 points)

An address has

  1. A house number, 2. A street, 3. an optional (positive >0) apartment number, 4. City 5. a state 6. and an (positive >0, 5 digit) integer zip code. Implement these in your class, along with getters and smart setters as shown in class. (6 points)

Supply two constructors: one that configures everything, and one for all but an apartment number. (2 points)

Supply a print method that prints the address with the street on one line, and the city; state; and zip code on the next line. (2 points)

Supply a method public boolean comesBefore(Address other) that tests whether this address comes before another when the addresses are compared by postal code. (2 points)

Part 2 (5 points)

Implement a VotingMachine class that can be used for a simple election. (1 point) Have methods to

  1. Clear the machine state (1 point)
  2. To vote for a Democrat (1 point
  3. To vote for a Republican (1 point)
  4. To get the tallies for both parties. (1 points)
  5. Part 3 (9 points)

Implement a class Student. (1 point)

For the purpose of this exercise, a student has a name and a total quiz score. Include getters and smart setters, like we did in class. (2 points)

Supply an appropriate (all variables) constructor (1 point) Implement methods (4 points)

  1. getName()
  2. addQuiz(int score) . Score must be a positive integer from 0 to 100.
  3. getTotalScore()
  4. getAverageScore(). To compute the latter, you also need to store the number of quizzes that the student took. (1 point)

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSE271-Lab 3-Implement a class Address,a VotingMachine class and a class Student
$25