Write a program that uses a structure to store the information about the Items in a retail store. It has Items with name, manufacturer (Final) and price.
1. Provide default & Parameterized constructors.
2. Provide getters & setters for data members.
3. Provide A toString() method to print values.
We can add several items to Store. Now create another class store which has name, city and array of Items.
1. Provide default & Parameterized constructors.
2. Provide getters & setters for data members.
3. Provide necessary validation checks ( null pointer exception, index out of bounds,etc). where possible.
4. Provide a method AddItem (Item i) which is used to add items into the store, but number of items should be less than the size of array (check for exception).
5. A print function which shows all items in the store.
6. Create Test Application and test the functionality of above classes.
Use exception also
Step by stepSolved in 2 steps with 1 images
- USING PYTHON LANGUAGE When prompting the user you must always include text which lets the user know what should be inputted. Write a program that creates a class named Person with three instance attributes: name, address, and cell_number as strings. Next, create a class named Customer (subclass) that inherits from the Person class. The Customer class should have two additional instance attributes: customer_number as a string. on_mailing_list as a boolean. Each class should include _init_) and _str-0 methods. The Customer class-_init__) and _str_-) methods must make a call to super) to access the Person's methods. After the Customer code, prompt the user to enter a name, address and cell_number for a person. Instantiate a Person object by passing in the user's input as the arguments and print out the Person's attributes by calling the -str-0 method. Next, prompt the user to enter a name, address, cellnumber, customer_number and on_mailing_list for a customer. Instantiate a Customer…arrow_forwardCreate a class called Student that models a student at Carleton University. A student's state consists of a name (String), id number (int) and a list of grades (array of double). Your class must have a constructor that has three input parameters (name, id and grade list) and sets the initial state for the object. Include a toString() method that returns a useful string representation of a student object. The string representation should contain the student's name, ID number, and the number of grades they have recorded (so NOT include all the grades). Include a gradesInRange(double lower, double upper) method that returns the number of grades that this student has that are in the range [lower,upper]. That is, the it returns the number of grades that are greater than or equal to lower and less than or equal to upper. Example Usage: double[] grades {81.2, 93.2, 76,2, 84.6, 63.11, 79.8}; Student s new Student("cat", 100123987, grades); s.gradesInRange (80,100); int num_grades_A // assert…arrow_forwardPart I Create a Warrior class that has properties given below. • String name, • int health, • int strength. Write the necessary constructor, get & set, and toString methods. Part II Write an defense method Warrior class that takes an integer parameter, hitPoint. The method decreases the Warrior's health depending on hitPoint. Part III Write a battle method for another class (Test) that takes two parameters: (1) Warrior object, (2) an integer monsterStrength parameter. The Warrior object defenses the attacks of the monster depending on monsterStrength until the Warrior health is below 30. Note: Do not compress your files, submit only java files. Note: Do ot forget to justify your answers with comments.arrow_forward
- Written in Python It should have an init method that takes two values and uses them to initialize the data members. It should have a get_age method. Docstrings for modules, functions, classes, and methodsarrow_forwardWrite a statement to create an array, named productList, in a supportive class, with a size of TEN and a data type of String: Question 7 (Mandatory) Write an invoke statement for the currentCircle object from the Circle class, to the behavior setCircleRadius, that invokes validateRadius in the parameters, which passes input in the parameters: ); Question 8 (Mandatory) Write a test condition for a selection structure that tests the values of the Strings named, userName and borrowedUserName, where case matters and the results will be -1, 0 or 1: Question 9 (Mandatory). Write a test condition for a selection structure that tests the values of the Strings named, userName and borrowedUserName, where case does not matter and the results will be true or false:arrow_forwardImplement a nested class composition relationship between any two class types from the following list: Advisor Вook Classroom Department Friend Grade School Student Teacher Tutor Write all necessary code for both classes to demonstrate a nested composition relationship including the following: a. one encapsulated data member for each class b. inline default constructor using constructor delegation for each class c. inline one-parameter constructor for each class d. inline accessors for all data members e. inline mutators for all data membersarrow_forward
- 1. Let's say you have a zoo (A place with animals). You want to store different animals. You will like to store their name, type/species, age, friendly-level, attendance (how long they have stayed in the zoo) etc. a. Create the class b. Create a method to set the attributes, create a method to get the attributes c. Write a method that prints the name and the type/species of the animal - on one line.arrow_forwardLab 6 - Exercise 2. Write a test driver that reads data about two surgeons and print the specialization of the doctor with the highest salary using the method that compares the salary of surgeons. A Doctor class has the following private data members, constructor, and public methods: name (String) salary (int) End of document I A constructor without parameters, A constructor with parameters, A set method for the data variables (one method) A get method for each data members. A method to print Doctor information A Surgeon is a subclass of Doctor with the following private data members, constructor, and public methods: specialization (String) degree (string) A constructor without parameters, A constructor with parameters, · A set method for the data variables (one method) · A get method for each data member. · A method to print all Surgeon information. · A method that compares the salary of two Surgeons and return the specialization of the doctor with the higher salary. 1. Implement the…arrow_forwardCreate a UML Diagram of a class named Investment with fields called principal and interest. It also contains methods named value_after that returns the value of the investment after n years. The formula for this is p(1+i)ⁿ, where p is the principal, and i is the interest rate.arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY