Java Intro 1
Scona Rap Battle!
Mr. Couprie grew up on the mean streets of St. Albert. It was a hard gangsta life but as you are no doubt aware, he emerged from this life and eventually became known as the King of Hip Hop. This assignment is dedicated to that time, not so long ago.
Create a new class as As1_Rap.java.
Variables Required
- Two String variables for Contestant1 and Contestant2’s names
- Two String variables for Contestant1 and Contestant2’s raps (only one variable for each rapper is needed)
- Two double variables for the two contestants’ average scores
- Three double variables for the judges scores
The program begins off air.
- Kindly ask the two contestants to enter their names. Scan them into the name variables.
- Then ask for each of their raps. Scan them into the rap variables. You only need to store each person’s wrap as one single variable. You can assume they will not type ‘ENTER’ until they are done.
- You will print back these 4 variables in the blank spaces below in the next section.
Then it is showtime! It is time to get into your show hosting character.
- Begin by introducing the program with a lines such as the following:
Yo, yo, yo homies. Welcome to Scona Rap Battle!
Lets’ say SUP to our first contestant _____.
And earlier we recorded the rap battles. Let’s hear the beats:
___________
Yo dawg that was the shizzle.
Now we are hanging with contestant two. His handle is ___
And here comes his rap:
_____
Daaang. This is going to be close.
- The user will then enter the 3 judges scores for the first contestant.
- Ask the user to enter the score for the first judge and scan it in.
- Then repeat for the other two judges
- OR, practice using random for the 3rd judge's score:
judge3 = (int) (Math.random( ) * 10 + 1);
- Calculate the average score for the contestant 1 and then store that average into the first average variable.
- Repeat for the second contestant, again asking and scanning in the 3 judges scores and again calculating the average score.
Now it is time to announce your winner
- Announce the average scores of each contestant.
- Using an IF statement, state who wins
Extra things to try (not for marks)
- Use the ANSII color codes to change the text color at appropriate times in the console.
- I have had a few students ask how to make the program pause for a few seconds before moving on. Want to know how to make your program pause? Try this:
try {
Thread.sleep(1000);
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
The 1000 is milliseconds so 2000 is a 2 second pause.