Related questions
Write code in C#
You must create parts of a small application that allows the user to manage the information on items for sale at a local store.
The system must allow a user to add, delete and search for items. The system can hold a maximum of 10000 items.
The class definition for an Item is given in the UML diagram below
Note: getInfo() returns a string containing ALL of the state information neatly organized.
Part 1:
Create a class based on the specification above.
Reminder: – means private and + means public.
Part 2:
a)
Write a function/method called "addItem" that takes:
- An array of items
- The number of items in the array
- An integer representing a barcode
- A string representing the name of an item
- A string representing the description of an item
- A double value representing the price
The function must create and add the item to the array if there is space. The function must return "true" if the addition was successful and "false" otherwise.
b)
Write a function/method called "listItems" that takes:
- An array of items
- The number of items in the array
The function must return a string containing the information on each item in the array.
c)
Write a function called "pricelookup" that takes :
- An array of items
- The number of items in the array
- An integer representing a barcode
The function must return the price of that item if it exits and -1 if no item with that barcode exits.
- d) Write a function called "deleteItem" that takes:
- An array of items
- The number of items in the array
- An integer representing a barcode
The function must remove/delete the item from the array if an item with that barcode exists. It must return a Boolean value where "true" means that the item was found and deleted. It must return "false" when the item was not found.
Part 3
Write a main program that (in order):
- Creates an array large enough to hold all of the items.
- Repeatedly asks the user for a barcode, name , description and price (based on the UML for Item) and adds item objects to the arrays created. This is done until a barcode of -1 is entered by the user.( Note if -1 is entered a name, description and price should not be requested)
- A list of all items should be displayed by using the functions/ methods created in part 2.
- The user should then be asked to enter a barCode to search for. The price of the item corresponding to the barCode entered should be displayed or "Item not found" should be displayed. You must use the functions/ methods created in part 2
- The user should then be asked to enter a barCode. The item corresponding to the barCode entered should be removed from the array if it exists. You must use the functions/ methods created in part 2.
- A list of all items should be displayed by using the functions/ methods created in part 2.
Step by stepSolved in 2 steps
- C++ Create a class named Student that has three member variables:name – A string that stores the name of the studentnumClasses – An integer that tracks how many courses the student is currently enrolledinclassList – A dynamic array of strings used to store the names of the classes that thestudent is enrolled inWrite appropriate constructor(s), mutator, and accessor methods for the class along with thefollowing: A method that inputs all values from the user, including the list of class names. Thismethod will have to support input for an arbitrary number of classes. A method that outputs the name and list of all courses. A method that resets the number of classes to 0 and the classList to an empty list. An overloaded assignment operator that correctly makes a new copy of the list ofcourses. A destructor that releases all memory that has been allocated.Write a main method that tests all of your functions.arrow_forwardIt is convention that all metmber variables in a Java class are declared to have_____ access so they are not accessible outside the class.arrow_forwardLab 2 – Designing a class This lab requires you to think about the steps that take place in a program by writing pseudocode. Read the following program prior to completing the lab. Design a class named Computer that holds the make, model, and amount of memory of a computer. Include methods to set the values for each data field, and include a method that displays all the values for each field. For the programming problem, create the pseudocode that defines the class and enter it below. Enter pseudocode herearrow_forward
- There are two types of data members in a class: static and non-static. Give an example of real-world use for a static data member.arrow_forwardUsing C++ Write a C++ program which uses a class that contains the following members: the name of a student, one midterm score, one final score, and one lab project score. The class also contains a member function that finds the average of the three scores and displays a grade based on that average (A for 90 and above, B for 80 and above, C for 70 and above, D for 60 and above, and F for anything less than 60). The class also contains a member function that displays a pass if the grade is D or above. Your program using overloading prints the grades of students, and names of the students.arrow_forwardc++ class runner with constructor and COPY CONSTRUCTORarrow_forward
- Use Java Programming Language Create a Loan Account Hierarchy consisting of the following classes: LoanAccount, CarLoan, PrimaryMortgage , UnsecuredLoan, and Address. Each class should be in it's own .java file. The LoanAccount class consists of the following properties: principal- the original amount of the loan. annualInterestRate - the annual interest rate for the loan. It is not static as each loan can have it's own interest rate. months - the number of months in the term of the loan, i.e. the length of the loan. and the following methods: a constructor that takes the three properties as parameters. calculateMonthlyPayment() - takes no parameters and calculates the monthly payment using the same formula as Assignment 1. getters for the three property variables. toString() - displays the information about the principle, annualInterestRate, and months as shown in the example output below. The CarLoan class which is a subclass of the LoanAccount class and consists of the...arrow_forwardB. Pet Class Using Python Program, Write a class named Pet, which should have the following data attributes: • _ _name (for the name of a pet) •__animal_type (for the type of animal that a pet is. Example values are 'Dog', 'Cat', and `Bird')' __age (for the pet's age) init The Pet class should have an method that creates these attributes. It should also have the following methods: set_name() This method assigns a value to the __name field. set_animal_type() This method assigns a value to the __animal_type field. • set_age() This method assigns a value to the • get_name() This method returns the value of the get_animal_type() This method returns the value of the __animal_type field. • get_age() This method returns the value of the _age field. Once you have written the class, write a program that creates an object of the class and prompts the user to enter the name, type, and age of his or her pet. This data should be stored as the object's attributes. Use the object's accessor methods...arrow_forward1. RetailItem Class Write a class named Retailltem that holds data about an item in a retail store. The class should have the following fields: • description. It is a String object that holds a brief description of the item. • unitsOnHand. It is an int variable that holds the number of units currently in inventory. • price. It is a double that holds the item's retail price. Write appropriate mutator methods that store values in these fields and accessor methods that return the values in these fields. Once you have written the class, write a separate program that creates three RetailItem objects and stores the following data in them. Units On Hold Description Designer Jeans Jacket Price 40 34.95 12 59.95 Shirt 20 24.95arrow_forward
- C++arrow_forwardAn Inventory structure is declared as follows: struct Inventory{int itemCode; int qtyOnHand;}; Write a definition statement that creates an Inventory variable named trivet and initializes it with an initialization list so that its code is 555 and its quantity is110.arrow_forwardThe following class definitions and function definitions should be used to help you finish the exam. train.h: car.h: #ifndef CAR_H #define CAR_H using namespace std; class Car #include "car.h" using namespace std; #ifndef TRAIN_H #define TRAIN_H class Train { private: Car* tHead; Car* tTail; public: Train(); -Train(); void addcarBack(Car *); void deleteFirstcar(); void removeFirstcaróftype(const string &); { private: string name; double maxSpeed; public: Car* nextcar; public: car(); Car(string); double getMaxspeed () const; string getName() const; void setName(const string &); }; #endif // Display list car by car void display() const; }; #endif Part of train.cpp: // addcarBack logic: if (traincarsHead == 0) { traincarsHead = toAdd; traincarsTail = toAdd; else { traincarstail->nextcar = toAdd; traincarsTail = toAdd;arrow_forward
- Text book imageComputer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONText book imageComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceText book imageNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Text book imageConcepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningText book imagePrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationText book imageSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY