Graderpractice for programmers

Back to 254275 OOP - Labs 6-10 Review

1. Create the Album class

Problem

Write a class named Album with fields for "title", "artist" and "songs".

Test code:

class Task1 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String title = sc.nextLine();
        String artist = sc.nextLine();
        int songs = Integer.parseInt(sc.nextLine());

        Album a1 = new Album(title, artist, songs);
        System.out.println(a1.getTitle() + " by " + a1.getArtist() + " is " + a1.getSongs() + " songs");
    }
}

Examples

Input

Sweetener
Ariana Grande
15

Output

Sweetener by Ariana Grande is 15 songs

Submit your solution

java