Answer to Question #294082 in Java | JSP | JSF for Manik

Question #294082

Ques- Write a code in Netbeans Java that will ask for item code, Item name and price of 3 items and display all information of all items

1
Expert's answer
2022-02-04T14:49:32-0500
import java.util.Scanner;


class App {


	public static void main(String[] args) {
		Scanner keyBoard = new Scanner(System.in);
		String itemCode[] = new String[10];
		String itemName[] = new String[10];
		double itemPrice[] = new double[10];
		for (int i = 0; i < 3; i++) {
			System.out.print("Enter item code: ");
			itemCode[i] = keyBoard.nextLine();
			System.out.print("Enter item name: ");
			itemName[i] = keyBoard.nextLine();
			System.out.print("Enter item price: ");
			itemPrice[i] = keyBoard.nextDouble();
			keyBoard.nextLine();
		}
		System.out.println();
		for (int i = 0; i < 3; i++) {
			System.out.println("Item code: " + itemCode[i]);
			System.out.println("Item name: " + itemName[i]);
			System.out.println("Item price: " + itemPrice[i]);
			System.out.println();
		}


		keyBoard.close();
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS