0% found this document useful (0 votes)
15 views3 pages

Lab 6 - Java Interface

This document outlines Lab 6 for EECE 332 Object Oriented Programming, focusing on Java Interfaces and Abstract Classes, due on July 9, 2025. Students will work in pairs to complete the assignment, which includes creating various shape classes and interfaces, and submitting required files in a zip format. General rules emphasize academic integrity, lab attendance, and provide guidelines for submission and project objectives.

Uploaded by

yareyaresass
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

Lab 6 - Java Interface

This document outlines Lab 6 for EECE 332 Object Oriented Programming, focusing on Java Interfaces and Abstract Classes, due on July 9, 2025. Students will work in pairs to complete the assignment, which includes creating various shape classes and interfaces, and submitting required files in a zip format. General rules emphasize academic integrity, lab attendance, and provide guidelines for submission and project objectives.

Uploaded by

yareyaresass
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Department of Electrical and Computer Engineering

EECE 332 Object Oriented Programming


Summer 2025

Class Instructor: Dr. Imad Moukadem, Lab Instructor: M. Zaher Kanafani

Lab 6 – Java Interfaces with more on Abstract Classes.

This programming assignment is due on Wednesday, July 9, 2025 at 1pm.

General Rules:
• Students will be divided in groups of 2 to work on the assignment. One submission per group.
• Cheating and Copying: Any form of cheating or copying from other students' group work will result in a
zero grade for all involved students, regardless of who copied from whom.
• Submissions are not allowed after 24 hours from the deadline. For any additional hour after the deadline,
a penalty of 4% will be applied.
• The instructor will explain to all students what is required, and give some useful hints.
• The lab will span one summer week.
• Be sure to stick to the sample run when provided, otherwise points will be deducted.
• You can ask questions during the lab, regarding what to do, not how to do.
• You can make use of your notes, and any information online including chatGPT and Google.
• You can use your laptops, or the available desktops.
• Students that have accommodation letters should contact us as soon as possible.
• Lab attendance is mandatory, it counts for 5% of the overall course grade.
• In case you have a valid excuse to miss a lab, please present it before the lab for the instructor approval.

Objectives:
• The purpose of this assignment is to provide students with Basic Class Object Creation and Manipulation.
• It includes Objects Creation, Composition and Inheritance.
• It covers also Java Interfaces and Abstract Classes.
• You are asked to use IntelliJ IDEA IDE for Java.

Deliverables:
• The .java file(s) requested in each problem.
• The word file for Parts A and C. Submit just one zip file.
• One submission per student or group of 2.
• As a comment, write your names in each .java submission.

Page 1 of 3
Problem
• Create the interface Shape with 2 abstract methods: void print() and double area().
• Create the interface shape2D extending from Shape with an additional method double perimeter().
• Create the interface shape3D extending from Shape with an additional method double volume().
• Create the classes Circles and Rectangles implementing interface shape2D.
• The circle has a radius, and the rectangle has a length and a width.
• Create the classes Cube, Sphere and Cylinder implementing interface shape3D.
• The sphere has a radius, the cube has a side, and the cylinder has a radius and a height.
• All member variables are of type double.
• All shapes must have the methods print() and area().
• 2D Shapes must have also the perimeter() method.
• 3D Shapes must have also the volume() method.
• The print() method will print the shape type, the member variables, the area, and perimeter /or volume.
• Include the needed constructors, setters and getters.

Part A-
• Draw the UML diagram of this design.

Part B-
• Create an ArrayList of type Shape, and a repetitive menu to instantiate any shape.
• Input the needed parameter(s). Add the instantiated shape in the ArrayList.
• Include try/catch blocks for any input error.
• Finally output all the instantiated shapes through the print() method.
• Format your numbers to 2 decimal points.

Part C-
• I would like to have a color (String) as an attribute for my shapes.
• Can I add color to the interface Shape?
• If not, is there any other alternative?
• Include your answer in a word file together with the diagram of part A.

Page 2 of 3
Circle Area = πR2 Perimeter = 2πR
Rectangle Area = LW Perimeter = 2(L+W)
Cube Area = 6S2 Volume = S3
Sphere Area = 4πR2 Volume = 4πR3/3
Cylinder Area = 2πR(R+H) Volume = πR2H

Sample Run

Page 3 of 3

You might also like