1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ivanzaharov [21]
3 years ago
13

Coding 5 - Classes The Item class is defined for you. See the bottom of the file to see how we will run the code. Define a class

ShoppingCart which supports the following functions: add_item(), get_total_price(), and print_summary(). Write code only where the three TODO's are. Below is the expected output: Added 2 Pizza(s) to Cart, at $13.12 each. Added 1 Soap(s) to Cart, at $2.25 each. Added 5 Cookie(s) to Cart, at $3.77 each.
Computers and Technology
1 answer:
ICE Princess25 [194]3 years ago
7 0

Answer:

Explanation:

The following is written in Java. It creates the ShoppingCart class as requested and implements the requested methods. A test class has been added to the main method and the output is highlighted in red down below.

import java.util.ArrayList;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       ShoppingCart newCart = new ShoppingCart();

       newCart.add_item();

       newCart.add_item();

       newCart.add_item();

       newCart.print_summary();

   }

}

class ShoppingCart {

   Scanner in = new Scanner(System.in);

   ArrayList<String> items = new ArrayList<>();

   ArrayList<Integer> amount = new ArrayList<>();

   ArrayList<Double> cost = new ArrayList<>();

   public ShoppingCart() {

   }

   public void add_item() {

       System.out.println("Enter Item:");

       this.items.add(this.in.next());

       System.out.println("Enter Item Amount:");

       this.amount.add(this.in.nextInt());

       System.out.println("Enter Cost Per Item:");

       this.cost.add(this.in.nextDouble());

   }

   public void get_total_price() {

       double total = 0;

       for (double price: cost) {

           total += price;

       }

       System.out.println("Total Cost: $" + total);

   }

   public void print_summary() {

       for (int i = 0; i < items.size(); i++) {

           System.out.println(amount.get(i) + " " + items.get(i) + " at " + cost.get(i) + " each.");

       }

       get_total_price();

   }

}

You might be interested in
________ is the concept describing the difference between people who have easy access to technology and those who do not.
earnstyle [38]

Answer:

The answer is Digital divide.

Explanation:

Digital divide describes the differences between people with access to the internet, computers or modern ICT or Information Communication Technology and the people that do not.

The effect of digital divide is described below:

  1. It affects economic growth. Due to a lack of access to technology in some areas, they experience low economic growth and cannot be compared to areas with easy access to technology.
  2. It affects education. Students with easy internet access and other technological facilities always have information at the tip of their fingers compared with students who only go to the libraries or listen to the radio to get information.
  3. It affects Political participation. Access to technology increases the citizen's participation in politics while it has a negative effect on places with no access to technology.
5 0
3 years ago
Write a complete program in Assembly Language: 1. Promts the user to enter 10 numbers. 2. saves those numbers in a 32 bit intege
Delicious77 [7]

Answer: provided in the explanation section

Explanation:

i hope this helps.

DATA SEGMENT

ARRAY DB 1,4,2,3,8,6,7,5,9

AVG DB ?

MSG DB "AVERAGE = $"

ENDS

CODE SEGMENT

ASSUME DS:DATA CS:CODE

START:

MOV AX,DATA

MOV DS,AX

LEA SI,ARRAY

LEA DX,MSG

MOV AH,9

INT 21H

MOV AX,00

MOV BL,9

MOV CX,9

LOOP1:

ADD AL,ARRAY[SI]

INC SI

LOOP LOOP1

DIV BL

ADD AL,30H

MOV DL,AL

MOV AH,2

INT 21H

MOV AH,4CH

INT 21H

ENDS

END START

cheers i hope this helps!!!

5 0
3 years ago
Read 2 more answers
List the main industries in Sierra Leone​
Dafna11 [192]

Answer:

The main industries in Sierra Leone are: Diamond mining

Petroleum refining

Small - scale manufacturing (beverage, textiles,footwear)

Explanation:

They also engage in commercial ship repair

3 0
3 years ago
Does anyone know how to execute this assignment on Scratch?
lapo4ka [179]

Execute this assignment from Scratch in the following way

Explanation:

1.For each thread, first Scratch sets the 'active thread' to that thread. Then, it executes each block one by one in the stack for the active thread. It will execute the entire stack all in one go if it can.

2.The Hide block is a Looks block and a Stack block. If the block's sprite is shown, it will hide the sprite — if the sprite is already hidden, nothing happens. This block is one of the simplest and most commonly used Looks blocks.

3.Scratch is used in many different settings: schools, museums, libraries, community centers, and homes.

4.Mitch Resnik, the creator of the super-simple Scratch programming language and head of the Lifelong Kindergarten group at the MIT Media Lab, gave a TEDx talk about the value of coding and computer literacy in early education.

5.

5 0
3 years ago
PLEASE I NEED HELP WITH THIS I WILL GIVE BRAINLIST!!!!!
Neko [114]
It would be so you like chocolate because there is only two options. Yes or no
8 0
3 years ago
Read 2 more answers
Other questions:
  • Write a program that reads from user (i) an hour between 1 to 12 and (ii) number of hours ahead. The program should print the ti
    15·1 answer
  • What parts of the computer does it not need to function?​
    9·1 answer
  • You are responsible for tech support at your company. You have been instructed to make certain that all desktops support file an
    15·1 answer
  • The Circular Flow Model includes serveral actors. Which of the following is NOT listed in the Circular Flow Model?
    12·1 answer
  • Which is the correct process for inserting a blank worksheet?
    11·2 answers
  • What factors should you consider when buying a hard drive?
    8·1 answer
  • The emergence of MP3 (iPod) technology is an example of creative destruction because a. It is less expensive than compact discs
    14·1 answer
  • Raw materials have two basic types what are the 2?
    11·2 answers
  • Anybody want to help me figure out how to put this on a resumè
    12·1 answer
  • True or false?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!