Académique Documents
Professionnel Documents
Culture Documents
The E-
mail class is provided below. An E-mail consists of a sender, a message, and a field that tells
whether or not the e-mail has been read.
An incomplete declaration for the OutLook class is shown below. The OutLook class contains
two ArrayLists: inbox and recycleBin. Each e-mail in the ArrayLists corresponds to a number
between 0 and the size of the list of e-mails minus one. For example, if there are 50 e-mails in
the inbox, the e-mails have a number between 0 and 49.
Task 2:
//Counts the number of e-mails in the inbox that have the same sender as the provided name.
Task #3:
//Remove the e-mail at the provided index and add it to the recycle bin for later deletion. Return
the number of e-mails in the recycle bin.
Task #4:
//Permanently removes all e-mails from the recycle bin. Return true when emptied successfully.
An incomplete declaration for the Flight class is shown below. Each flight has seats numbered 0,
1, 2.... up to the capacity of the flight. For example, a flight with 100 seats would have room for
numbers 0 through 99.
//Contains names of people who have not been assigned to a seat because the flight was full
//Represents the maximum number of passengers that are allowed on the flight
Task #2:
//If there are more seats available on the flight, then create a passenger with the provided name for the next
//empty seat on the flight and add the passenger to the /flight. If there are no more seats available on the flight,
//add the person's name to the wait list. Return true if the person was able to reserve a seat on the flight and
//false otherwise.
Task #3:
//Release the seat occupied by the provided passenger. If there are names on the waiting list,
//remove the first name from the list, create a Passenger with the name and the seat number just
//released, and add this passenger to the flight. If the person from the waiting list was added to
//the flight, return true. If the waiting list is empty, return false.
//The airline puts all passengers whose names have four letters in the front of the flight. If the
//provided name has four letters, create a passenger and add them to the first seat of the flight. If
//the name does not have four letters, add them to the next available seat on the flight. Return
//true if the person has reserved a seat on the flight and false otherwise. You must use the
reserveSeat method previously completed assuming that the method works as intended.
An incomplete declaration for the BirthdayBoard class is shown below. The person information
contained in the birthday board is in no particular order.
Task 1:
//Display the names of all the people with a birthday in the provided month.
//Return the name of the person who was born latest in the year.
An incomplete declaration for the BowlingGame class is shown below. The BowlingGame class
contains one ArrayList called game that consists of Frames, and the name of a bowler. Each
frame in the ArrayList corresponds to a number between 0 and the size of the game list minus
one. For example, if there are 10 frames in the game, the frames have a number between 0 and 9
}
Here is a sample game to use as test data:
name=”Joseph Blo”
game (with 7 frames)
Frames:
1 2 3 4 5 6 7
Rolls:
4 10 6 7 5 0 7
3 0 3 3 2 10 2
When a 10 is recorded for roll 1, then the player got a strike. When the sum of the roles is 10
and the first roll is not a 10, then the player got a spare. In the above diagrams, the second frame
represents a strike and the 4th and 6th frames are spares.
When a spare or strike is recorded in the last (10th frame) the bowler is awarded an extra (third)
roll which is added to the second roll for the purposes of simplicity.
Task #1:
//Write the Bowling Game constructor that creates a 10 frame game with all rolls initialized to 0.
//The bowler’s name should be initialized to “none”.
public BowlingGame()
Task #2: Write a constructor for the BowlingGame calls that creates a 10 frame game that uses
a random number for the first roll and a random possible complement for the second roll. The
bowler’s name should be set to parameter that is passed to the constructor. Be sure to account for
a strike or spare in the last frame by adding an extra randomly generated roll to the second roll.
Task #3:
//in bowling, if you have a “mark” on your score card, then you rolled a strike or a spare. Write
//code to count the number of marked frames in a game and return the count.
//There are few rules for calculating a bowling score. If a spare is rolled in a frame, then the
frame’s score is calculated by adding 10 to the first roll of the next frame. If a strike is rolled in
a frame, then the score is calculated by adding 10 to both rolls of the next frame. If neither a
spare or strike is rolled then the total of the rolls are added to the score. Calculate and return the
score for an initialized bowling game.
Task #6:
//Calculate and display the score of each team member. In completing the task, you must use the
//calcScore method in Task 5 assuming it works as intended.
//The team member with the highest average is the MVB (Most Valuable). Return the name of
//the team member who is the MVB. In performing the work of this function, you must use the
//calcScore method of Task 5 assuming it works as intended.