Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 15 pages
Exam (elaborations)

Computer Science Assignment Solutions: Triangle Class, Exception Handling, Score Processing, and Colorable Interface

Document preview thumbnail
Preview 2 out of 15 pages

Explore comprehensive solutions for Java programming assignments covering inheritance, exception handling, file processing, and interface implementation. Includes UML diagrams, code examples, and output.

Content preview

ASSIGNMENT 3




COSC1047: INTRODUCTION TO COMPUTER SCIENCE 2




MAYURKUMAR MANIYA
249484080

, EXERCISE: 1




METHODOLOGY:

• Create a GeometricObject class with attributes for color and filled state.
• Define a constructor in GeometricObject to initialize its attributes.
• Create a Triangle class that extends GeometricObject and adds three sides.
• Implement constructors in Triangle to initialize the side lengths, color, and filled status.
• Implement the getArea() method using Heron’s Formula for area calculation.
• Implement the getPerimeter() method to sum up the sides of the triangle.
• Override the toString() method in Triangle to display triangle properties.
• Develop a TriangleTest class to take user input and create a Triangle object.
• Print the triangle details, including its color, fill state, area, and perimeter.
• Run the program in Eclipse to verify correctness and validate user input.


UML DIAGRAM:

Document information

Uploaded on
November 3, 2025
Number of pages
15
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$14.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
sammysamcho
2.5
(2)
Sold
14
Followers
7
Items
1174
Last sold
1 month ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions