+ 1

What's wrong in this code

I dont know what's wrong here im just new this was our project https://code.sololearn.com/cVdXYC3Tht0F/?ref=app

28th Sep 2022, 2:27 PM
Abdul Jabul
Abdul Jabul - avatar
10 Réponses
+ 2
You are not imported Scanner class...!!! edit: import java.util.Scanner;
28th Sep 2022, 2:45 PM
Jayakrishna 🇮🇳
+ 1
Abdul Jabul Recreate means? Looks like you edited code to wrong one.. 1) Add statement : import java.util.Scanner; //1 as a first statement of your program. 2) line 18 : replace with this Scanner s = new Scanner(System.in); //2 // this is correct instruction which you have previously but now wrong. Change to this line. 3) Run your program and test with this sample input to your program. 2 5 no 500 //3 Hit submit button of popup. You can see output. 2 changes you need and test with that sample-> //3 Better you remove for payment input.
28th Sep 2022, 3:49 PM
Jayakrishna 🇮🇳
0
> What's wrong in this code Which ERROR exactly do you encounter? What is the expected input? What is the expected output?
28th Sep 2022, 2:44 PM
Lisa
Lisa - avatar
0
The error is the scanner what do i supposed to do
28th Sep 2022, 3:07 PM
Abdul Jabul
Abdul Jabul - avatar
0
What this means Scanner ^
28th Sep 2022, 3:08 PM
Abdul Jabul
Abdul Jabul - avatar
0
Add this as first line : import java.util.Scanner;
28th Sep 2022, 3:10 PM
Jayakrishna 🇮🇳
0
Can you recreate it its supposed to be ordering mechanism
28th Sep 2022, 3:32 PM
Abdul Jabul
Abdul Jabul - avatar
0
import java.util.Scanner; public class cart { //To publicly access the quantity as it updates every time you wish to buy again public static int total_quantity=0; //I have declared 4 products here public static String[] products = {null, "(1) Cookies and Cream Milktea 50.00pesos", "(2) Chocolate Milktea 40.00pesos", "(3) Java Chips Milk Tea 65.00pesos", "(4) Wintermelon Milktea 1000.00pesos"}; //Prices in accordance of their elements public static int[] product_price ={0,50,40,65,1000}; //This is the cart for the check-out of all order you have public static int[] final_qty=new int[5]; public static void main(String[] args) Scanner s = new Scanner(System.in); Scanner s = (javautil.scanner); int choose, quantity; int p1=0; int p2=0; int p3=0; int p4=0; char decision; System.out.println("Welcome to Day Dreamer's Milktea Shop, please choose any of the menu:"); do { for(int i = 0; i < products.length; i++) { if(products[i] != null) System.out.println(products[i]); } //This is for asking to choose any item from
29th Sep 2022, 4:27 PM
Kayode
Kayode - avatar
0
Oma firma
29th Sep 2022, 6:34 PM
Stefan Viiol
0
Shreyansh Recreate means? Looks like you edited code to wrong one.. 1) Add statement : import java.util.Scanner; //1 as a first statement of your program. 2) line 18 : replace with this Scanner s = new Scanner(System.in); //2 // this is correct instruction which you have previously but now wrong. Change to this line. 3) Run your program and test with this sample input to your program. 2 5 no 500 //3 Hit submit button of popup. You can see output. 2 changes you need and test with that sample-> //3 Better you remove for payment input.
30th Sep 2022, 1:37 PM
Devil Hacker SHREYANSH SINGH😏😏
Devil Hacker  SHREYANSH SINGH😏😏 - avatar