0

Tracking Customer Data

Please look at the sections //set customer's data to object and // add all necessary attributes import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); String firstName = read.nextLine(); String secondName = read.nextLine(); int age = read.nextInt(); int roomNumber = read.nextInt(); Customer customer = new Customer(); //set customer's data to object here customer.firstName = firstName; customer.secondName = secondName; customer.age = age; customer.roomNumber = roomNumber; customer.saveCustomerInfo(); } } class Customer { //add all necessary attributes here String firstName = customer.firstName; String secondName = customer.secondName; int age = customer.age; int roomNumber = customer.roomNumber; public void saveCustomerInfo() { System.out

10th Nov 2021, 6:11 PM
Natanael
8 Respostas
+ 3
What help do you need? Is this given incomplete code that you need to solve?
10th Nov 2021, 6:37 PM
Shivani 📚✍
Shivani 📚✍ - avatar
+ 1
class Customer { //add all necessary attributes here String firstName, secondName; int age, roomNumber; public void saveCustomerInfo() { System.out.println("fake save"); } }
11th Nov 2021, 12:42 AM
zemiak
0
This is the last part of the code that displays customer info public void saveCustomerInfo() { System.out.println("First name: " + firstName ); System.out.println("Second name: " + secondName); System.out.println("Age: " + age); System.out.println("Room number: " + roomNumber); }
10th Nov 2021, 6:15 PM
Natanael
0
Shivani, this code will not work, it gives me error message "cannot find symbol"
10th Nov 2021, 6:42 PM
Natanael
0
The problem will be in the sections I mentioned above
10th Nov 2021, 6:45 PM
Natanael
0
Thank you zemiak
11th Nov 2021, 12:52 AM
Natanael
0
u should write Customer class as a inner class for Main class so that u can solve thiss error
12th Nov 2021, 3:30 AM
èŠéƒšé˜”èĄ€
èŠéƒšé˜”èĄ€ - avatar
0
䜠ćș”èŻ„èż™æ ·ć†™ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); Customer customer = new Customer(); //set customer's data to object here customer.firstName = read.nextLine(); customer.secondName = read.nextLine(); customer.age = read.nextInt(); customer.roomNumber = read.nextInt(); customer.saveCustomerInfo(); } } class Customer { //add all necessary attributes here String firstName,secondName; int age,roomNumber; public void saveCustomerInfo() { System.out.println(firstName + secondName + age + roomNumber); } }
12th Nov 2021, 3:56 AM
èŠéƒšé˜”èĄ€
èŠéƒšé˜”èĄ€ - avatar