Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Sport Rental Shop READ ALL OF THE INSTRUCTIONS AND SPECIFICATIONS CAREFULLY! You will find your Final Project in the following zipfile, SnowFinal.zip. Make sure to

Sport Rental Shop

READ ALL OF THE INSTRUCTIONS AND SPECIFICATIONS CAREFULLY!

You will find your Final Project in the following zipfile, SnowFinal.zip. Make sure to unzip the zipfile into your Netbeans Project folder. There are four files in which you will be writing code to fulfill the Final Project portion of the Final Exam.

The four files are: SportShopRental.java, SkiRental.java, SnowboardRental.java, and SnowMobileRental.java.

In each file, you will find comments with the specifications of what you are to do. You must implement SportShopRental.java first as it is the parent class for SkiRental.java, SnowboardRental.java, and SnowMobileRental.java.

You will also find four .pdf files of the UML class diagrams in the project's main folder.

There is a folder in the project called Test that has JUnitTests for you to check your work after implementing each of the parent and child classes (you will not be able to run the JUnitTest for the respective parent or child class until at least all of the member functions have been implemented. In order to run the JUnitTest, you will want to have the JUnitTest source file window open in Netbeans and select from the Run menu, Run File. You are not to alter the contents of the JUnitTest files (these are merely for you to check your work - I will have a seperate set of test files that I use for grading the Final Project).

Special note: Make sure the member functions all have exactly the same names as provided in the UML class diagrams (you are not allowed to name the functions whatever you wish, doing so will most likely fail the unit tests).

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Please do code in Java and simple as possible!

* SkiRental.java * SnowmobileRental.java x Source History 1 . 9 9 package fal18: SportShopRental.java TBB SnowboardRental.java x O N // 25 pts total (15 points for correct implementation (3 pts per section below), 10 points code passes all unit test). // Refer to the UML class diagram for naming of all methods in this class: SkiRentalUML.pdf // 1. Create public class named SkiRental that inherits Sport ShopRental. // 2. Create a private integer member variable named size and initialized to 175 // 3. Implement the abstract method lateCharge which was declared in Sport ShopRental. // The method should only return 10% of the rental cost. 16 // 4. Implement the toString method that returns a string in the following format: // "Rental #{s}, Cost: ${s), New: {s}, Size: {1} cm" // where: {s} is the format specifier for integers from Sport ShopRental class toString method (hint: utilize the super keyword), // {s} is the format specifier for doubles with width of 7 characters and 2 decimal places of precision from Sport ShopRental class toString method (hint: utilize the super keyword), // {s} is the format specifier for boolean values from Sport Shop Rental class toString method (hint: utilize the super keyword), {1} is the format specifier for integer with a field width of 4 characters. 18 // 5. Create all getters and setters for private member variables created in step #2. Note below is specifics for data validation // in specified setter methods below: // a. In setter method for setting size, throw a new IllegalArgumentExcetion for any size that is less than 50 or greater than 200, with the exception message: "Size out of range SkiRental -Size : int +getSize(): int +setSize(int size) : void +toString(): String +lateCharge(): double SkiRental.java Snow MobileRental.java * SportShopRental.java x Source History - 39 B package fal18: SnowboardRental.java x O OM // 25 pts total (15 points for correct implementation (3 pts per section below), 10 points code passes all unit test). // Refer to the UML class diagram for naming of all methods in this class: SnowboardRentalUML.pdf // 1. Create public class named SnowboardRental that inherits Sport ShopRental. // 2. a. Create a private integer member variable named size and initialized to 140. // a. Create a private boolean member variable named freestyle and initialized to true. // 3. Implement the abstract method lateCharge which was declared in Sport ShopRental. // The method should only return 20% of the rental cost. // 4. Implement the toString method that returns a string in the following format: // "Rental # {s}, Cost: ${s}, New: {s}, size: {1} cm, {2}" where: {s} is the format specifier for integers from Sport ShopRental class toString method (hint: utilize the super keyword). {s} is the format specifier for doubles with width of 7 characters and 2 decimal places of precision from Sport ShopRental class toString method (hint: utilize the super keyword), {s} is the format specifier for boolean values from Sport ShopRental class toString method (hint: utilize the super keyword), {1} is the format specifier for integer with a field width of 4 characters, {2} is the format specifier for a string "freestyle" if freestyle member variable is true, other wise "alpine". // 5. Create all getters and setters for private member variables created in step #2. Note below is specifics for data validation // in specified setter methods below: // a. In setter method for setting size, throw a new IllegalArgumentExcetion for any size that is less than 50 or greater than 180, with the exception message: Size out of range Snowboard Rental -Size : int -freestyle : boolean +getSize(): int +setSize(int size) : void +isFreestyle(): boolean +setFreestyle(boolean freestyle) : void +toString(): String +lateCharge(): double SkiRental.java x SnowmobileRental.java * Source History E - package fal18 SportShopRental.java * 9 PBB SnowboardRental.java x W - // 25 pts total (15 points for correct implementation (3 pts per section below), 10 points code passes all unit test). // Refer to the UML class diagram for naming of all methods in this class: SnowMobileRentalUML.pdf // 1. Create public class named SnowmobileRental that inherits Sport ShopRental. // 2. a. Create a private integer member variable named capacity and initialized to 1. // a. Create a private string member variable named vin and initialized to "14234567890123456789". // 3. Implement the abstract method lateCharge which was declared in Sport ShopRental. // The method should only return (20 + capacity * 5)% of the rental cost. // 4. Implement the toString method that returns a string in the following format "Rental #{s}, Cost: ${s), New: {s}, Capacity: {1} seat, Vin: {2}" where: {s} is the format specifier for integers from Sport ShopRental class toString method (hint utilize the super keyword), {s} is the format specifier for doubles with width of 7 characters and 2 decimal places of precision from Sport ShopRental class toString method (hint: utilize the super keyword), {s} is the format specifier for boolean values from Sport ShopRental class toString method (hint: utilize the super keyword), {1} is the format specifier for integer with a field width of 1 character, {2} is the format specifier for a string. // 5. Create all getters and setters for private member variables created in step #2. Note below is specifics for data validation // in specified setter methods below: // a. In setter method for setting capacity, throw a new Illegal ArgumentExcetion for // any capacity that is less than one or greater than three, with the exception message: "Capacity out of range b. In setter method for setting vin, throw a new Illegal ArgumentException for any vin that has the number of characters greater than 20, with the exception message: "Vin cannot be more than 20 characters" Snow Mobile Rental -capacity: int -vin : String +getCapacity(): int +SetCapacity (int capacity) : void +getVin(): String +setVin(String vin) : void +toString(): String +lateCharge(): double x SkiRental.java x Snow MobileRental.java x SportShopRental.java x Source History - 1979 PB B package fal18: SnowboardRental.java O W- 1 // 25 pts total (15 points for correct implementation (3 pts per section below), 10 points code passes all unit test). // Refer to the UML class diagram for naming of all methods in this class: Sport ShopRentalUML.pdf // 1. Create abstract class named Sport Shot Rental. // 2. a. Create private boolean member variable named newModel and initialize to false. 7 b. Create private double member variable named rentalCost and initialize to 25.0. // C. Create private long member variable named rentalNumber and initialize to 1. // 3. Create all getters and setters for private member variables created in step #2. Note below is specifics for data validation // in specified setter methods below: // a. In setter method for setting rental cost, throw a new Illegal ArgumentExcetion for I any rental cost that is less than or equal to zero, with the exception message: "RentalCost out of range" 7 b. In setter method for setting rental number, throw a new IllegalArgumentException for any rental number that is less than 1 or greater than 999999999999, with the exception message: "RentalNumber out of range" 1/ 4. Create the overrided method named toString that returns a string in the format of: // "Rental # {1}, Cost: ${2}, New: {3}" // where: {1} is the format specifier for integers, {2} is the format specifier for doubles with width of 7 characters and 2 decimal places of precision, (3) is the format specifier for boolean values. // 5. Create the abstract method lateCharge that takes no parameters and returns the late charge as a double. SportShop Rental -newModel : boolean -rentalCost : double -rentalNumber : long +isNewModel(): boolean +setNew Model(boolean newModel) : void +getRentalCost(): double +setRentalCost(double rentalCost) : void +getRentalNumber(): long +setRentalNumber(long rentalNumber): void +toString(): String +lateCharge(): double * SkiRental.java * SnowmobileRental.java x Source History 1 . 9 9 package fal18: SportShopRental.java TBB SnowboardRental.java x O N // 25 pts total (15 points for correct implementation (3 pts per section below), 10 points code passes all unit test). // Refer to the UML class diagram for naming of all methods in this class: SkiRentalUML.pdf // 1. Create public class named SkiRental that inherits Sport ShopRental. // 2. Create a private integer member variable named size and initialized to 175 // 3. Implement the abstract method lateCharge which was declared in Sport ShopRental. // The method should only return 10% of the rental cost. 16 // 4. Implement the toString method that returns a string in the following format: // "Rental #{s}, Cost: ${s), New: {s}, Size: {1} cm" // where: {s} is the format specifier for integers from Sport ShopRental class toString method (hint: utilize the super keyword), // {s} is the format specifier for doubles with width of 7 characters and 2 decimal places of precision from Sport ShopRental class toString method (hint: utilize the super keyword), // {s} is the format specifier for boolean values from Sport Shop Rental class toString method (hint: utilize the super keyword), {1} is the format specifier for integer with a field width of 4 characters. 18 // 5. Create all getters and setters for private member variables created in step #2. Note below is specifics for data validation // in specified setter methods below: // a. In setter method for setting size, throw a new IllegalArgumentExcetion for any size that is less than 50 or greater than 200, with the exception message: "Size out of range SkiRental -Size : int +getSize(): int +setSize(int size) : void +toString(): String +lateCharge(): double SkiRental.java Snow MobileRental.java * SportShopRental.java x Source History - 39 B package fal18: SnowboardRental.java x O OM // 25 pts total (15 points for correct implementation (3 pts per section below), 10 points code passes all unit test). // Refer to the UML class diagram for naming of all methods in this class: SnowboardRentalUML.pdf // 1. Create public class named SnowboardRental that inherits Sport ShopRental. // 2. a. Create a private integer member variable named size and initialized to 140. // a. Create a private boolean member variable named freestyle and initialized to true. // 3. Implement the abstract method lateCharge which was declared in Sport ShopRental. // The method should only return 20% of the rental cost. // 4. Implement the toString method that returns a string in the following format: // "Rental # {s}, Cost: ${s}, New: {s}, size: {1} cm, {2}" where: {s} is the format specifier for integers from Sport ShopRental class toString method (hint: utilize the super keyword). {s} is the format specifier for doubles with width of 7 characters and 2 decimal places of precision from Sport ShopRental class toString method (hint: utilize the super keyword), {s} is the format specifier for boolean values from Sport ShopRental class toString method (hint: utilize the super keyword), {1} is the format specifier for integer with a field width of 4 characters, {2} is the format specifier for a string "freestyle" if freestyle member variable is true, other wise "alpine". // 5. Create all getters and setters for private member variables created in step #2. Note below is specifics for data validation // in specified setter methods below: // a. In setter method for setting size, throw a new IllegalArgumentExcetion for any size that is less than 50 or greater than 180, with the exception message: Size out of range Snowboard Rental -Size : int -freestyle : boolean +getSize(): int +setSize(int size) : void +isFreestyle(): boolean +setFreestyle(boolean freestyle) : void +toString(): String +lateCharge(): double SkiRental.java x SnowmobileRental.java * Source History E - package fal18 SportShopRental.java * 9 PBB SnowboardRental.java x W - // 25 pts total (15 points for correct implementation (3 pts per section below), 10 points code passes all unit test). // Refer to the UML class diagram for naming of all methods in this class: SnowMobileRentalUML.pdf // 1. Create public class named SnowmobileRental that inherits Sport ShopRental. // 2. a. Create a private integer member variable named capacity and initialized to 1. // a. Create a private string member variable named vin and initialized to "14234567890123456789". // 3. Implement the abstract method lateCharge which was declared in Sport ShopRental. // The method should only return (20 + capacity * 5)% of the rental cost. // 4. Implement the toString method that returns a string in the following format "Rental #{s}, Cost: ${s), New: {s}, Capacity: {1} seat, Vin: {2}" where: {s} is the format specifier for integers from Sport ShopRental class toString method (hint utilize the super keyword), {s} is the format specifier for doubles with width of 7 characters and 2 decimal places of precision from Sport ShopRental class toString method (hint: utilize the super keyword), {s} is the format specifier for boolean values from Sport ShopRental class toString method (hint: utilize the super keyword), {1} is the format specifier for integer with a field width of 1 character, {2} is the format specifier for a string. // 5. Create all getters and setters for private member variables created in step #2. Note below is specifics for data validation // in specified setter methods below: // a. In setter method for setting capacity, throw a new Illegal ArgumentExcetion for // any capacity that is less than one or greater than three, with the exception message: "Capacity out of range b. In setter method for setting vin, throw a new Illegal ArgumentException for any vin that has the number of characters greater than 20, with the exception message: "Vin cannot be more than 20 characters" Snow Mobile Rental -capacity: int -vin : String +getCapacity(): int +SetCapacity (int capacity) : void +getVin(): String +setVin(String vin) : void +toString(): String +lateCharge(): double x SkiRental.java x Snow MobileRental.java x SportShopRental.java x Source History - 1979 PB B package fal18: SnowboardRental.java O W- 1 // 25 pts total (15 points for correct implementation (3 pts per section below), 10 points code passes all unit test). // Refer to the UML class diagram for naming of all methods in this class: Sport ShopRentalUML.pdf // 1. Create abstract class named Sport Shot Rental. // 2. a. Create private boolean member variable named newModel and initialize to false. 7 b. Create private double member variable named rentalCost and initialize to 25.0. // C. Create private long member variable named rentalNumber and initialize to 1. // 3. Create all getters and setters for private member variables created in step #2. Note below is specifics for data validation // in specified setter methods below: // a. In setter method for setting rental cost, throw a new Illegal ArgumentExcetion for I any rental cost that is less than or equal to zero, with the exception message: "RentalCost out of range" 7 b. In setter method for setting rental number, throw a new IllegalArgumentException for any rental number that is less than 1 or greater than 999999999999, with the exception message: "RentalNumber out of range" 1/ 4. Create the overrided method named toString that returns a string in the format of: // "Rental # {1}, Cost: ${2}, New: {3}" // where: {1} is the format specifier for integers, {2} is the format specifier for doubles with width of 7 characters and 2 decimal places of precision, (3) is the format specifier for boolean values. // 5. Create the abstract method lateCharge that takes no parameters and returns the late charge as a double. SportShop Rental -newModel : boolean -rentalCost : double -rentalNumber : long +isNewModel(): boolean +setNew Model(boolean newModel) : void +getRentalCost(): double +setRentalCost(double rentalCost) : void +getRentalNumber(): long +setRentalNumber(long rentalNumber): void +toString(): String +lateCharge(): double

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions