├── Artists ├── Artist.class ├── Genre.class ├── Singer.class ├── ArtistDemo.class ├── ArtistDemo.java ├── Singer.java ├── Instructions.txt └── Artist.java └── README.md /Artists/Artist.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marieemoiselle/CS211LabActivity3/HEAD/Artists/Artist.class -------------------------------------------------------------------------------- /Artists/Genre.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marieemoiselle/CS211LabActivity3/HEAD/Artists/Genre.class -------------------------------------------------------------------------------- /Artists/Singer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marieemoiselle/CS211LabActivity3/HEAD/Artists/Singer.class -------------------------------------------------------------------------------- /Artists/ArtistDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marieemoiselle/CS211LabActivity3/HEAD/Artists/ArtistDemo.class -------------------------------------------------------------------------------- /Artists/ArtistDemo.java: -------------------------------------------------------------------------------- 1 | public class ArtistDemo { 2 | public static void main(String[] args) { 3 | // instance of Artist 4 | Artist artist = new Artist("Charlie Puth", "American", 32, "Music"); 5 | artist.displayInfo(); 6 | 7 | System.out.println(); 8 | 9 | Singer singer = new Singer("Nayeon Im", "Korean", 29, "Music", Genre.POP); 10 | singer.displayInfo(); 11 | 12 | } 13 | } -------------------------------------------------------------------------------- /Artists/Singer.java: -------------------------------------------------------------------------------- 1 | enum Genre { 2 | POP, 3 | ROCK, 4 | CLASSICAL, 5 | JAZZ, 6 | HIPHOP 7 | } 8 | 9 | class Singer extends Artist { 10 | private Genre genre; 11 | 12 | public Singer(String name, String nationality, int age, String specialty, Genre genre) { 13 | super(name, nationality, age, specialty); 14 | this.genre = genre; 15 | } 16 | 17 | public Genre getGenre() { 18 | return genre; 19 | } 20 | 21 | public void setGenre(Genre genre) { 22 | this.genre = genre; 23 | } 24 | 25 | @Override 26 | public void displayInfo() { 27 | System.out.println("== Singer Info =="); 28 | super.displayInfo(); 29 | System.out.println("Genre: " + genre); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Artists/Instructions.txt: -------------------------------------------------------------------------------- 1 | Base Class: Artist 2 | Derived Classes: 3 | 4 | 1. Painter 5 | Properties (Use enums): 6 | Medium: 7 | - OIL 8 | - WATERCOLOR 9 | - ACRYLIC 10 | - PENCIL 11 | - CHARCOAL 12 | 13 | 2. Singer 14 | Properties (Use enums): 15 | Genre: 16 | - POP 17 | - ROCK 18 | - CLASSICAL 19 | - JAZZ 20 | - HIPHOP 21 | - RNB 22 | 23 | 3. Writer 24 | Properties (Use enums): 25 | WritingStyle: 26 | - FICTION 27 | - NONFICTION 28 | - POETRY 29 | - DRAMA 30 | 31 | 4. Dancer 32 | Properties (Use enums): 33 | DanceStyle: 34 | - BALLET 35 | - HIPHOP 36 | - JAZZ 37 | - CONTEMPORARY 38 | 39 | Driver Code: ArtistDemo.java -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CS 211: Object-oriented Programming 2 | by: **Ms. Fatima Marie P. Agdon, MSCS** 3 | ## Laboratory Activity 3 4 | 5 | **Instructions:** Create derived classes for the `Artist` base class, as stated below. 6 | 7 | | Derived Class | Enum | Pre-defined Properties | 8 | |---------------|-------------|------------------------------------------| 9 | |🎤 `Singer` |`Genre` |`POP`, `ROCK`, `CLASSICAL`, `JAZZ`, `HIPHOP`, `RNB` | 10 | |🎨 `Painter` |`Medium` |`OIL`, `WATERCOLOR`, `ACRYLIC`, `PENCIL`, `CHARCOAL`| 11 | |✍🏻 `Writer` |`WritingStyle` |`FICTION`, `NONFICTION`, `POETRY`, `DRAMA` | 12 | |💃🏻 `Dancer` |`DanceStyle` |`BALLET`, `HIPHOP`, `JAZZ`, `CONTEMPORARY` | 13 | 14 | Rubrics and other instructions are posted in the Google Classroom. 15 | 16 | ## SAMPLE OUTPUTS 17 | **Instance of `Artist` class** 18 | ``` 19 | Artist Name: Charlie Puth 20 | Age: 32 21 | Specialty: Music 22 | ``` 23 | 24 | **Instance of `Singer` class** 25 | ``` 26 | Singer's Info: 27 | Artist Name: Nayeon Im 28 | Age: 29 29 | Specialty: Music 30 | Genre: POP 31 | ``` 32 | 33 | Happy coding! 🩷 -------------------------------------------------------------------------------- /Artists/Artist.java: -------------------------------------------------------------------------------- 1 | public class Artist { 2 | 3 | //member variables 4 | private String name; 5 | private String nationality; 6 | private int age; 7 | private String specialty; 8 | 9 | public Artist(String name, String nationality, int age, String specialty) { 10 | this.name = name; 11 | this.nationality = nationality; 12 | this.age = age; 13 | this.specialty = specialty; 14 | } 15 | 16 | // accessors 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public String getNationality() { 22 | return nationality; 23 | } 24 | 25 | public int getAge() { 26 | return age; 27 | } 28 | 29 | public String getSpecialty() { 30 | return specialty; 31 | } 32 | 33 | //mutators 34 | public void setName(String name) { 35 | this.name = name; 36 | } 37 | 38 | public void setNationality(String nationality) { 39 | this.nationality = nationality; 40 | } 41 | 42 | public void setAge(int age) { 43 | this.age = age; 44 | } 45 | 46 | public void setSpecialty(String specialty) { 47 | this.specialty = specialty; 48 | } 49 | 50 | // display method 51 | public void displayInfo() { 52 | System.out.println("Artist Name: " + name); 53 | System.out.println("Age: " + age); 54 | System.out.println("Specialty: " + specialty); 55 | } 56 | } --------------------------------------------------------------------------------