Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the following CyclingGlass and SwimmingGlass subclass are inherited from SportVisionShop superclass. Superclass : SportVisionShop Attributes: private String custorderNo private String custorderDate private double depositPymt

image text in transcribed

image text in transcribedimage text in transcribed

image text in transcribed

Given the following CyclingGlass and SwimmingGlass subclass are inherited from SportVisionShop superclass. Superclass : SportVisionShop Attributes: private String custorderNo private String custorderDate private double depositPymt Il customer order number // date of order public ClearVisionShop (String orderno, orderDate, double deposit) // getter and setter methods Abstract Method: public abstract double calCharges () //method to calculate the price Subclass : Cycling Glass Attributes: private char type_glass /* 'I' Transition Glass, 'p' Polarized glass, 'I' - Iridium glass */ private boolean uvProtection; /* with UV protection extra RM 30 will be charge to the total price */ Method: /ecessary constructor, getter and setter methods public double calcharges () //method to calculate charges=price-deposit public String toString() // method to display the data members Details of charges are shown in Table below: Glass Type Price Transition RM 400.00 Polarized RM 450.00 Iridium RM 600.00 Subclass : SwimmingGlass Attributes: private char Type; // 'A' Anti-fogging goggle, 'S' - short-sighted goggle private String style; // Retro, "Warrior" or "Modern Method: /ecessary constructor, getter and setter methods public double calcharges () //method to calculate the price public String toString() // method to display the data members Details of charges are shown in table below: Style and Discount Glass Type Price Retro Modern RM 180.00 8% 10% Anti-Fogging goggle Short-sighted goggle RM 300.00 5% 10% a) Write the constructor definition for both subclasses. (4 marks) b) Write the definition of calcharges() for both subclasses. (8 marks) C) Write a Java application which uses the concept of polymorphism to: 1. Store data on various types glasses into an array of object. The number of data to be stored and information on each glass are given by the user. II. Determine and display the number of customers who buy cycling and swimming glass from the clearVisionShop outlet. III. Display information of all customer who have bought short-sighted goggle (Swimming Glass). (13 marks)

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

Computer Aided Database Design

Authors: Antonio Albano, Valeria De Antonellis, A. Di Leva

1st Edition

0444877355, 978-0444877352

More Books

Students also viewed these Databases questions

Question

1. Identify what positions are included in the plan.

Answered: 1 week ago

Question

2. Identify the employees who are included in the plan.

Answered: 1 week ago

Question

7. Discuss the implications of a skill-based pay plan for training.

Answered: 1 week ago