Академический Документы
Профессиональный Документы
Культура Документы
• In main() method, create two Rectangle objects: rectangle1 and rectangle2, rectangle with
width of 5, height of 2, rectangle2 with width of 8.8, height of 12, print out the area of
both rectangles
2. Create a Song class with the following attributes and methods:
Song
-title: String
-genre: String
-artist: String
-album: String
-price: double
+Song()
+Song(title: String, genre: String, artist: String, album: String, price: double)
+getTitle(): String
+getGenre(): String
+getArtist(): String
+getAlbum(): String
+getPrice(): double
+setTitle(newTitle: String): void
+setGenre(newGenre: String): void
+setArtist(newArtist: String): void
+setAlbum(newAlbum: String): void
+setPrice(newPrice: double): void
+toString(): String
• Create one Song object named myFavoriteSong in main() method, with the following
information:
• Title: Hotel California
• Genre: Rock
• Artist: Eagles
• Album: The very best of the Eagles
• Price: $0.99
Student
-id: String
-firstName: String
-lastName: String
-major: String
-gpa: double
+Student()
+Student(id: String, firstName: String, lastName: String, major: String, gpa: double)
+getId(): String
+getFirstName(): String
+getLastName(): String
+getMajor(): String
+getGPA(): double
+setId(id: String): void
+setFirstName(firstName: String): void
+setLastName(lastName: String): void
+setMajor(major: String): void
+setGPA(gpa: double):void
+toString():String
• In main() method, create a Student object named me, fill in your information, then print
out all the information of me object.