Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please solve the following questions using java Assignment 1 Instructions: (The Triangle class) Design a class named Triangle that extends This assessment covers the contents

image text in transcribedimage text in transcribedplease solve the following questions using java

Assignment 1 Instructions: (The Triangle class) Design a class named Triangle that extends This assessment covers the contents discussed in Chapter 10 and 11 GeometricObject. The class contains: - All submitted assigned work must conform to proper Java programming style and documentation. - Three double data fields named side1, side2, and side3 with default valEspecially regarding naming conventions. ues 1.0 to denote three sides of a triangle. - Your source code should contain comments describing the functionality and the major components of each object and method. - A no-arg constructor that creates a default triangle. - Student full name and student number MUST be included on each submitted work A constructor that creates a triangle with the specified side1, side2, and - The word file/ pdf is to be submitted in which you paste the screenshot of code and its output side 3. executed in Vs code - The file should have proper page borders and formatting. Student name, assignment name, ID number should be displayed on every page header. - All assigned work should be completed by the student without the collaboration of others. - Unauthorized collaboration will be treated as violations of academic integrity under the Sheridan's - The accessor methods for all three data fields. A method named getArea () that returns the area of this triangle. Academic Integrity Policy. - All assignment solutions should be uploaded to the appropriate Assignments folder A method named getPerimeter () that returns the perimeter of this triangle. - Professional/personal integrity is very important. Any noted cheating will be dealt accordingly with A method named toString () that returns a string description for the triangle. the Sheridan's policies. - For writing code, proper indentation, naming conventions are to be followed. For the formula to compute the area of a triangle, see Programming Exercise 2.19. The tostring () method is implemented as follows: Questions: return "Triangle: side 1="+ side 1+" side 2="+ side 2+ " side 3="+ side 3 Draw the UML diagrams for the classes Triangle and Geometric0bject and implement the classes. Write a test program that prompts the user to enter three sides of the triangle, a color, and a Boolean value to indicate whether the triangle Q1. Write the code for the following UML diagram using Inheritance is filled. The program should create a Triang1e object with these sides and set the color and fi11 ed properties using the input. The program should display the area, perimeter, color, and true or false to indicate whether it is filled or not. Q3. (The Aecoumt class) Druign a class named Account that contains: A private int data field named id for the accoant (default of. - A private double data ficld named balance for ine acsodim (defaulu 0). - A private double data field named annual fnterest Rate that stores the cur- rent interest rate (defailt ok Assurse that all accouns have the same interest mate. account was crealed. - A no-arg constructor that creates a default account. A constractor that creates an account with the specified id and initial bulance. The acceswor and matator methods for id, bat 1 anoe, and annua 1 InterastRate. a A method named gethonthly InterestRote () that renums the monshly inierest rate. = A melbod named pe thonthlyInterest() that retarns the muethly intercst. A method named withdraw that withdraws a specified amount from the account, A metbod named depos it that deposits a specified amount to the account. Draw the UMLL diagram for the class then implement the class. (Friue: The method getMonthly interest () is to netum monthly interest, not the interest nate, Monthly interest is batance " ounthiylnteres thate. wonthiy yinteres- centage, for example 4.5%. You necd to divide it by 1000 ) Writc a test program that creates an Account object with an account ID of 1122 , a bolance of 520.000, and an annual interest rate of 4.5%, Use the wi thuiraw method to withdraw $2.500, wse the depos tt incthod to deposia $3,000, and print the bal- ance, the monthly interest, and the date when this account was created. Q4. Please note that Exercise 9.7 in this Question refers to the Q3 of this assignment. **11.8 (New Account dass) An Account class was specified in Programning Exerche 9.7. \$11,6 The Transact ion class describes a transaction for a bunk account. - Modify the withdraw and deposit methods to add a transaction to the transactiona array list. - All other progerties and methods ane the same as in Prugramiming Evercise 9.7. Rubrics (10 marks total): Originality and correctness 6 marks Proper Programming Style (indentationaming conventions/spacing etc.)- 4 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

How To Make A Database In Historical Studies

Authors: Tiago Luis Gil

1st Edition

3030782409, 978-3030782405

More Books

Students also viewed these Databases questions

Question

Distinguish between poor and good positive and neutral messages.

Answered: 1 week ago

Question

Describe the four specific guidelines for using the direct plan.

Answered: 1 week ago