Question: I've made a code for the LiFi Unit 7 assignment and I can't get it to go through. I've tried to model it after similar

I've made a code for the LiFi Unit 7 assignment and I can't get it to go through. I've tried to model it after similar projects but I cannot get it to compile. I need to fix this before I leave for a trip tomorrow where I will not have phone/internet access

import java.io.File; import java.util.Scanner;

public class TSUnit7 { public static void main (String[] args) { Scanner stdIn = new Scanner(System.in); Scanner stdInFile; try { stdInFile = new Scanner(new File("TSUnit7House.txt")); } catch (Exception e) { System.out.println ("Unable to open file"); return; } TSUnit7House house1, house2; //New houses

//Create house 1 using default constructor TSUnit7House house1 = new TSUnit7House(); house1.print(); //print house 1 with default values

String street, city, state, zipCode; int number;

System.out.println("Importing Number."); number = stdInFile.nextInt(); stdInFile.nextLine(); System.out.println("Importing Street."); street = stdInFile.nextLine(); System.out.println("Importing City."); city = stdInFile.nextLine(); System.out.println("Importing State."); state = stdInFile.nextLine(); System.out.println("Importing ZipCode."); zipCode = stdInFile.nextLine(); System.out.println();

//use method call chaining to set values //and print results for house 1 house1.setNumber(number).setStreet(street) .setCity(city).setState(state) .setZipCode(zipCode).print();

System.out.println("Importing Number."); number = stdInFile.nextInt(); stdInFile.nextLine(); System.out.println("Importing Street."); street = stdInFile.nextLine(); System.out.println("Importing City."); city = stdInFile.nextLine(); System.out.println("Importing State."); state = stdInFile.nextLine(); System.out.println("Importing ZipCode."); zipCode = stdInFile.nextLine(); System.out.println();

//create house 2 using 5 parameter constructor TSUnit7House house2 = new TSUnit7House(number, street, city, state, zipCode);

//print house 2 house2.print();

} }

Original class instructions are as follows

Basic Requirements Write a driver and house class that gets input and using method call chaining creates 2 houses, imports the data from a text file, and outputs the results. Refer to chapter 3 on how to read in a file. LiFiUnit7.java Provide a driver class that demonstrates this house class. You the code below as the contents of you main method. Ensure you use the code provided exactly as given 20% inside your main method except for renaming your House class. Scanner stdIn = new Scanner(System.in); Scanner stdInFile = new Scanner(new File("LiFiUnit7HouseData.txt")); LiFiUnit7House_SU_2016 house1, house2; //New houses //Create house 1 using default constructor house1 = new LiFiUnit7House_SU_2016(); house1.print(); //print house 1 with default values String street, city, state, zipCode; int number; System.out.println("Importing Number."); number = stdInFile.nextInt(); stdInFile.nextLine(); System.out.println("Importing Street."); street = stdInFile.nextLine(); System.out.println("Importing City."); city = stdInFile.nextLine(); System.out.println("Importing State."); state = stdInFile.nextLine(); System.out.println("Importing ZipCode."); zipCode = stdInFile.nextLine(); System.out.println(); //use method call chaining to set values //and print results for house 1 house1.setNumber(number).setStreet(street) .setCity(city).setState(state) .setZipCode(zipCode).print(); System.out.println("Importing Number."); number = stdInFile.nextInt(); stdInFile.nextLine(); System.out.println("Importing Street."); street = stdInFile.nextLine(); System.out.println("Importing City."); city = stdInFile.nextLine(); System.out.println("Importing State."); state = stdInFile.nextLine(); System.out.println("Importing ZipCode."); zipCode = stdInFile.nextLine(); System.out.println(); //create house 2 using 5 parameter constructor house2 = new LiFiUnit7House_SU_2016(number, street, city, state, zipCode); //print house 2 house2.print(); This demonstration driver does not call all accessor and mutator methods but it is normal to create them regardless of an immediate use. They may be needed in the future. Sample output is provided below. Be sure to mimic it exactly except for values entered. LiFiUnit7House.java Write a House class called LiFiUnit7House.java that implements the following methods. setNumber receives the house number setStreet receives the street name setCity receives the city name setState receives the state name setZipCode receives the zip code Separate accessor methods for each instance variable utilized. 30% Method Call Chaining Pay attention to implement method call chaining as prescribed in the main method given. This is the main part of the program for this week. 40% NOTE: Complete your activity and submit it by clicking Submit Assignment Total Percentage 100% Data for Text File (name it LiFiUnit7House.txt) 8700 NW River Park Dr. Parkville MO 64152 1600 Pennsylvania Ave

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!