As a review of Java fundamentals, we are going to be modelling some basic information about a wedding. Upon completion of all steps below, you should upload your App.java file to Canvas. Important:...

1 answer below »

As a review of Java fundamentals, we are going to be modelling some basic information about a wedding. Upon completion of all steps below, you should upload your App.java file to Canvas.



Important: Make sure that you follow the approach given in class. We want to learn specific methods for accomplishing these tasks that will help us prepare for our more advanced future topics.




Step 1:



  • Create a file named App.java containing a class named App. Add your main() method to this class.


Recall that you can use VSCode shortcuts to create your class and main method. It is also fine to create your Java file in NetBeans if you prefer.




Step 2:


Use appropriate data types to store the following information:




  1. The names of the bride and groom


  2. The total number of guests at the wedding


  3. The square footage of the location (must be accurate to 0.1 square feet).


  4. The names of each song in the DJ's playlist. You should use an ArrayList of Strings to store this, and the user should be able to enter as many song names as they wish.


  5. The number of guests per square foot of the location.




Step 3:


Add static methods to:




  1. Prompt the user for the names of the bride and groom (note: you may use two separate methods for this). Return these values.


  2. Prompt the user for number of guests at the wedding. Return this value.


  3. Prompt the user for the square footage of the location. Return this value.


  4. Prompt the user for names of each song in the DJ's playlist. Store these values in your ArrayList. You should prompt the user to continue entering songs or to quit.Do not ask the user how many songs they'd like to enter in advance.


  5. Calculate and return the number of guests per square foot of the location.




Step 4:


Add functionality to:




  • Save all data to a file called wedding.txt (please use FileWriter or PrintWriter as shown in class)


  • Load and display the contents of this file (please use Scanner as shown in class)


Note: please use basic exception handling (i.e. a try block) when attempting to access a file.




Step 5:


Add logic to your main() method that uses all of the methods you’ve created in order to prompt the user for values, store their responses, save those values to a file, and display the contents of the file.

Answered Same DaySep 06, 2021

Answer To: As a review of Java fundamentals, we are going to be modelling some basic information about a...

Aditya answered on Sep 07 2021
127 Votes
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Arra
yList;
import java.util.Scanner;
public class App {
    public static void main(String[] args) {
        String brideName, groomName;
        int totalNumberOfGuest;
        float squareFootage;
        ArrayList songList;
        float numberOfGuestPerSquarefeet;
        Scanner scanner = new Scanner(System.in);
        groomName = getGroomName(scanner);
        brideName = getBrideName(scanner);
        songList = getSongList(scanner);
        totalNumberOfGuest = getNumberOfGuest(scanner);
        squareFootage = getSquareFootage(scanner);
        
        numberOfGuestPerSquarefeet = getPerSquare(totalNumberOfGuest, squareFootage);
        String fileName = "wedding.txt";
        
        try
        {
            File file = new File(fileName);
            FileWriter fileWriter = new FileWriter(file);
            fileWriter.write("Groom Name: "+...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here