Can you fix this code? Please 🥺 | Sololearn: Learn to code for FREE!

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

11/30/2021 7:04:32 PM

Mirasol Sontousidad

12 Answers

New Answer

+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.

+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.

+2

Is your quuestion already answered?

+2

I think first you need to better grasp the concept of OOP in java . 😇 Very seriously I suggest you to revise the concept of OOP here or some other platforms or through books . ☺️ The point is that community is always ready to help and guide you but first you needed to understand the fundamentals of any topic regarding which you're asking here and I think either you strongly hates java or CS or you don't want to upgrade yourself with learning . 😅

+1

https://code.sololearn.com/c84iO0czJhaY/?ref=app

+1

Here's my code

+1

Can you fix that

+1

0

0

Already fixed filipina sis ☺️ https://code.sololearn.com/c979SKcqdVo9/?ref=app Remember you can set the discount whatever you want in the getDiscount() method of PreferredCustomer class . 😇

0

Can you explain me what is Java and how to study them