tubeshowcase●1,194,391 videos♡ My collection 0
← Learn to Code

Learn to Code06:31

Code a simple java shopping cart program in 6 minutes! 🛒

Bro Code ↗

From the creator

#java #javatutorial #javacourse import java.util.Scanner; public class Main { public static void main(String[] args) { // SHOPPING CART PROGRAM Scanner scanner = new Scanner(System.in); String item; double price; int quantity; char currency = '$'; double total; System.out.print("What item would you like to buy?: "); item = scanner.nextLine(); System.out.print("What is the price for each?: "); price = scanner.nextDouble(); System.out.print("How many would you like?: "); quantity = scanner.nextInt(); total = price * quantity; System.out.println("\nYou have bought " + quantity + " " + item +"/s"); System.out.println("Your total is " + currency + total); scanner.close(); } }

Published 2024-12-05 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code