Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Jul 2017 |
Last Sign in: | 213 Weeks Ago, 5 Days Ago |
Questions Answered: | 15833 |
Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Please I need this code fixed it's due in a few hours and I don't know what's wrong I get the following errors
Â
Exception in thread "main" java.lang.Error: Unresolved compilation problem:Â
The method setStreet(String) is undefined for the type Object
Â
at HMUnit7.main(HMUnit7.java:31)
---------------------------------------------------------------------------------------
Â
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
Â
public class HMUnit7 {
Â
public static void main(String[] args) throws FileNotFoundException {
Scanner stdIn = new Scanner(System.in);
Scanner stdInFile = new Scanner(new File("LiFiUnit7House.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();
Â
}
Â
}
Attachments:----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly