Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TED UNIVERSITY Computer Engineering Department Lab Assignment 11 2017 Fall, CMPE 112 Fundamentals of Programming I Question 1 Write a class called Product with the

image text in transcribed
image text in transcribed
image text in transcribed
TED UNIVERSITY Computer Engineering Department Lab Assignment 11 2017 Fall, CMPE 112 Fundamentals of Programming I Question 1 Write a class called Product with the following variables and methods Variables (5 points) (All variables should be declared as private.) name >String price double quantity-> int type-> String Methods (20 points) . get and set methods for all variables. setProductinformation method gets name, price and quantity as parameter and sets related variables . printino method prints the product information as given in the sample output. Question 2 Write a class called ShoppingCart which has a main method. First create an array of taken products with an initial size of 0. ( Product" products = new Product or ) Your program should perform four different operations and it should ask for an operation until user enters 5. 1-Add product (20 points) Ask for product name, price and quantity of the product. Create a new Product object and set related information by using setProductinformation method. Increase the size of products array and add the new product to the array Let's remember how to increase size of an array create a new temporary array of size+ 1 dopy aa items of the orignal array to temporary array and add the new item to the ast slot of temporary array assign temporary array to the original array o 2-Enter tyee (15 points) . Ask for name of the product. (You may assume that an existing product will be entered )

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

When might a supertype/subtype hierarchy be useful?

Answered: 1 week ago

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago