Lab9

.docx

School

Georgia Southern University *

*We aren’t endorsed by this school

Course

1301

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

2

Uploaded by BaronBoulderSeahorse44

Report
CSCI 1301 Programming Principles Lab 9 Due date: November 3, 2023 (Friday), 5:00pm 2D Array of Objects Create a 2-D array of MyPoint objects. Design a class named MyPoint to represent a point. The class contains: Two double private data fields named x and y that specify the coordinates of a point. A pubic no-arg constructor that creates a default point (0, 0). A pubic constructor that creates a point with specified x and y coordinates. Two sets of pubic get and set methods for the two private data fields. Write a test class named Lab9 with a main method to create a 2 by 3 array filled with points 1 as follows: (0.5, 1.2) (0.0, 3.14) (15.0, 27.5) (6.6, 7.7) (1.2, 2.1) (12.0, 127.0) In your main method, use a pair of nested for-loops to print the contents of the array. Your output should appear as below: Array[0][0] = (0.5, 1.2) Array[0][1] = (0.0, 3.14) Array[0][2] = (15.0, 27.5) Array[1][0] = (6.6, 7.7) Array[1][1] = (1.2, 2.1) Array[1][2] = (12.0, 127.0) Requirements : (1) Draw the UML of MyPoint class; (2) implement MyPoint class; (3) implement Lab9 class with a main method . Save the two program files as MyPoint.java and Lab9.java. Grading: This lab is worth 100 points. Out of 100 maximum points, the UML will count for 20 points, the two source codes will count for 80 points . Submission: For this assignment, please name your class file as “MyPoint” 1 (3.5, 2.7) is a notation that describes a point with x=3.5 and y=2.7.
package homework; public class MyPoint { //Please write your code here } Please name your test program as “Lab9” package homework; public class Lab9 { // Main method public static void main(String[] args ) { //Please write your code here } } How to hand in the assignment Follow the steps below: 1. Complete the UML in a Microsoft Word document or other document file format, and the programs in .java files. Once you are done, convert your UML file to a PDF (.pdf) . 2. Upload the .java files as well as the PDF document UML into Gradescope. Do not submit a .docx file for the UML, first convert your file to PDF (.pdf) . 3. Click “Upload”. I remind you that if you do not submit the assignment before the due date, you will not be able to submit it. Note : Your output should look exactly like the output below and should be able to run test cases. Array[0][0] = (0.5, 1.2) Array[0][1] = (0.0, 3.14) Array[0][2] = (15.0, 27.5) Array[1][0] = (6.6, 7.7) Array[1][1] = (1.2, 2.1) Array[1][2] = (12.0, 127.0)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help