Remember not to create packages. Use the default package
3A
Fizzbin is a game from Alpha Centari. It is a game of skill not luck. To make the game competitive among players of different skill levels, a score adjustment system has been devised. Each player has an adjustment value ranging from 0 to 40. The better the player, the lower the adjustment value. after a round of play, every player's adjustment value is added to his / her score. The player with the highest final score is the winner.
For this assignment, you will complete the FizzbinPlayer
class. I supply the tester. Your class will not have a main method.
The FizzbinPlayer
class has:
getName()
which returns the name of the playergetAdjustment()
that returns the adjustment valuesetAdjustment()
which will assign a new adjustment value to this player
Provide Javadoc for the constructor and all methods. The Javadoc for the class is given to you
3B
Write a VotingMachine
class that models a simple voting machine to tally the votes on a California proposition.
VotingMachine
has a constructor with no parameters and initializes the yes and no counts
It has methods
voteYes
voteNo
getYesVotes
getNoVotes
There is no starter file for this project, but there is a tester.
Provide Javadoc for the constructor, all methods and the class itself.
3C
Write a SuburbanTrain
class. A SuburbanTrain
moves along a track from the start to the end . There are stops every 5 miles. The track is 50 miles long. The SuburbanTrain
moves from one stop to another. It can either move toward the end (+ direction) or towards the start (- direction). Write a class SuburbanTrain
that models this behavior.
SuburbanTrain
class has a default constructor that sets the train at the start moving toward the end (+ direction). You can think of this as a number line with only positive numbers and zero.
SuburbanTrain
has these methods
public void move(int numberOfStops)
- moves the train the specified number of stops in the current direction. Assume the user is well behaved and never tries to move beyond the start or end of the trackpublic void turn()
- reverses the direction of the train. If the train was moving from start to end (+ direction), after the method executes, the train will be moving toward the start (- direction)public int distanceToStart()
- calculates the distance the train is from the start in milespublic int distanceToEnd()
- calculates the distance the train is from the end in milesDo not use if statements.
Think about what information needs to be remembered and define instance variables to remember that information.
HINT: You can represent the direction with an integer: +1 if the train is moving toward the end; -1 if it is moving towards the start.
HINT: Remember that each stop is 5 miles from the previous stop. So if a train has moved 3 stops along the track, its distance from the start is 15. It will probably be easiest to call the start location stop number 0.
Javadoc for the class might look like this:
/**
* Models a train running on a straight track going either direction
*/