Can you fix this code? Please 🥺 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can you fix this code? Please 🥺

class Customer { public static void main(String[] args) { String pcName; String pcAddress; String pcPhone; String pcNumber; boolean pcOnMailList; String pcMailResponse; String pcYes = "y"; int pcAmountSpent; Scanner keyboard = new Scanner(System.in); System.out.println("Mira Puerto:"); pcName = keyboard.nextLine(); System.out.println("Toledo,Cebu:"); pcAddress = keyboard.nextLine(); System.out.println("09434567867:"); pcPhone = keyboard.nextLine(); System.out.println("09633665321:"); pcNumber = keyboard.nextLine(); System.out.println("yes:"); pcMailResponse = keyboard.nextLine(); System.out.println("2000:"); pcAmountSpent = keyboard.nextInt(); if (pcMailResponse.startsWith(pcYes)) { pcOnMailList = true; } else { pcOnMailList = false; } PreferredCustomer jim = new PreferredCustomer(pcName, pcAddress, pcPhone, pcNumber, pcOnMailList, pcAmountSpent); System.out.println(); System.out.println("Customer:"); System.out.println("Nam

30th Nov 2021, 7:04 PM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
9 Answers
+ 2
Did you already see here a Sololearn Playground, where can code be running and tested? You can save there your code and provide a link here for it, together with you question and description, what you want with it do. Now your code is incomplete and in addition we do not know what is the target of it.
30th Nov 2021, 7:42 PM
JaScript
JaScript - avatar
+ 2
You try to initialize an object with: PreferredCustomer jim = new PreferredCustomer(pcName, pcAddress, pcPhone, pcNumber, pcOnMailList, pcAmountSpent); But you have no above mentioned class in this code.
30th Nov 2021, 8:13 PM
JaScript
JaScript - avatar
+ 2
Is your quuestion already answered?
30th Nov 2021, 9:40 PM
JaScript
JaScript - avatar
30th Nov 2021, 7:56 PM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
+ 1
Here's my code
30th Nov 2021, 7:57 PM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
+ 1
Can you fix that
30th Nov 2021, 7:57 PM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
+ 1
Not yet
30th Nov 2021, 10:23 PM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
0
18
2nd Dec 2021, 1:06 PM
Mohammed zus
Mohammed zus - avatar
0
Can you explain me what is Java and how to study them
2nd Dec 2021, 6:41 PM
Jyoti Patil