Question Description
There are three parts to the Homework.
please keep it simple. No need for //comments. just the code is fine.
Please submit each part in its own .java file.
- B01 Playlist Part I (25 points): Create and upload a java file called PlaylistPartI.java.
- B02 Playlist Part II (25 points): Create and upload a java file called PlaylistPartII.java.
- B03 Counting Votes (25 points): Create and upload a java file called Votes.java.
B01 – Playlist I
Context: You will write a program that manages a playlist. In this program, the user will add songs to the playlist.
Important: Your playlist will only allow 10 and only 10 songs. You can assume the playlist will not have less than 10, or more than 10 songs. Don't use an ArrayList for this exercise.
Your playlist will consist of a collection of titles of songs and that's it. It will not contain the duration or anything other than the title of the song.
You need to:
1. Create a method to ask the user for the title of the different songs to add to the playlist, and add those titles to your array until the playlist is full. Your method must return the full playlist.
2. Once your program has asked the user to fill the playlist, from your main method you will iterate the playlist and print the title of the songs in the order they were added.
Use JOptionPane dialogs to display messages and ask for the user input.
B02 – Playlist II
Context: You will write a program that manages the playlist created in the previous exercise. In this program, the user will be able to listen to that playlist and perform actions such as move to the next song, or move back to the previous song.
You need to:
1. Once your program has asked the user to fill the playlist, from your main method you will call a new method play.
2. This method play will:
2.1. Display a dialog with the following message: "Now playing <title of the first song in the playlist>"
2.2. Display a dialog with an option menu like the following:
"The following actions are supported. Enter the code:
A: Repeat current song
B: Move to the next song
C: Move to the previous song
D: Exit"
If the user enters A, then your program will go back to step 3.1 but with the current song.
If the user enters B, then your program will move to the next song in the playlist and go back to step 3.1, but with the new current song.
If the user enters C, then your program will move back to the pervious song in the playlist, and go back to step 3.1 but with the new current song.
If the user enters D, then your program will finish.
NOTE: If the user moves past the last song, then the new current song will be the first one. That is, if the user tries to move to the 11th song, but there are only 10 songs, then the playlist will go back to the first song in the playlist.
Similarly, if the user tries to move back from the first song, then the playlist will move to the last song in the playlist. That is, if the playlist is playing the first song, and the user moves back, it will move back to the last song in the playlist.
Use JOptionPane dialogs to display messages and ask for the user input.
Context: You will write a program that will allow users to enter electoral votes between two candidates A and B. Then, it will automatically count how many votes each candidate received and display a summary with the results.
Important: In this case, first you will ask how many people will vote. For each vote, the name of the candidate will be added to the collection.
Your program needs to do the following:
1. Have a method that first asks how many users will vote and then, it will display the following menu and ask the users to enter the candidate they are voting for.
"Voting system. Please, enter:
A – To vote for candidate A.
B – To vote for candidate B.
Z – To finish the voting process.
Anything else will be considered as an INVALID vote."
As new votes are entered, your program needs to add the appropriate value to the collection (either the name of the candidate, or "INVALID" for invalid votes). When Z is entered, your program will stop asking for votes and will return the collection of votes added so far.
2. With the list of votes, your program will call another method that will count how many votes each candidate received, and how many invalid votes were entered in the system. Then, it will display a dialog with the following format:
Results:
A received X votes (<percentage of votes for A>%).
B received Y votes. (<percentage of votes for B>%)
Z votes were invalid. (<percentage of invalid votes>%)
Total: M votes were entered in the system.
Important: You need to use JOptionPane dialogs to display messages and ask for inputs.
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
About Writedemy
We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.
How It Works
To make an Order you only need to click on “Place Order” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Are there Discounts?
All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.