So, i want the programm to get 2 inputs from the user( car1money car1gas) and outprint them after it gets it. NOTE: i want this to be done with object and method procedures in order to understand the concepts of them( ignore the variables car2money and car2gas cause basically its the same thing). i know this is basic and im not sure if i should post it, but ill make this attemt to get help.
import java.io.*; class testCars { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //fields double car1money; double car2money; double car1gas; double car2gas; cars car1 = new Car1object(); car1.Car1Method(); } class cars{ //constructor Car1object(double car1money,double car1gas){ this.car1money= car1money; this.car1gas = car1gas; } //method Car1Method(){ System.out.println(" Money for the 1st car: "); car1money= br.read(); System.out.println(" gas for the 1st car: "); car1gas= br.read(); System.out.println("You typed:" + car1money + car1gas); } }
P.S. you can ignore the "throws IOexception" thank you in advance