Complete the Clothing class, the class should have the following instance variables, constructor(s) and instance methods: An instance variable of type double named price. An instance variable of type String named type. An instance variable of type String named size. A default "no-arg" constructor that sets the price to 29.9, the type to "T- Shirt" and the size to "Medium". An overloaded constructor that takes three parameters and set the instance variables accordingly. A method named increasePrice that takes no parameters and returns no value, the method increases the instance variable price by 5. An overloaded method increasePrice that takes a double parameter x and returns no value, the method increases the instance variable price by the value of parameter x. A method named details which takes no parameters, returns no value, the method prints the Clothing item details in the format shown in the sample output.
Complete the Clothing class, the class should have the following instance variables, constructor(s) and instance methods: An instance variable of type double named price. An instance variable of type String named type. An instance variable of type String named size. A default "no-arg" constructor that sets the price to 29.9, the type to "T- Shirt" and the size to "Medium". An overloaded constructor that takes three parameters and set the instance variables accordingly. A method named increasePrice that takes no parameters and returns no value, the method increases the instance variable price by 5. An overloaded method increasePrice that takes a double parameter x and returns no value, the method increases the instance variable price by the value of parameter x. A method named details which takes no parameters, returns no value, the method prints the Clothing item details in the format shown in the sample output.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Expert Solution
Step 1
Given data,
The Clothing class, the class should have the following instance variables, constructor(s) and instance methods:
- An instance variable of type double named price.
- An instance variable of type String named type.
- An instance variable of type String named size.
- A default “no-arg” constructor that sets the price to 29.9, the type to “T-Shirt” and the size to “Medium”.
- An overloaded constructor that takes three parameters and set the instance variables accordingly.
- A method named increasePrice that takes no parameters and returns no value, the method increases the instance variable price by 5.
- An overloaded method increasePrice that takes a double parameter x and returns no value, the method increases the instance variable price by the value of parameter x.
- A method named details which takes no parameters, returns no value, the method prints the Clothing item details in the format shown in the sample output.
Sample Output:
Item: T-Shirt
Size: Medium
Price: $29.9
Item: T-Shirt
Size: Medium
Price: $34.9
Item: T-Shirt
Size: Medium
Price: $41.9
Item: Jeans
Size: Small
Price: $31.2
Item: Jeans
Size: Small
Price: $41.2
Item: Jeans
Size: Small
Price: $45.2
Step by step
Solved in 3 steps with 3 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY