Song


Submit solution

Points: 10
Time limit: 5.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C#, Go, Java

Crea l'objecte Song i asigna-li els camps amb les dades de l'entrada.

    import java.util.Scanner;

    class Song {
        String name;
        String artist;
        float rating;
        boolean favorite;
    }

    public class Solution {

        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);

            // escriu aqui el codi

            System.out.print(song.favorite ? "<3 " : "   ");
            System.out.println(song.artist + " - " + song.name);
            for (int i = 0; i < (int) song.rating; i++) {
                System.out.print("*");
            }
        }
    }

Input Format

-

Constraints

-

Output Format

-

Sample Input 0

One love
Bob Marley
4.5
true

Sample Output 0

<3 Bob Marley - One love
****

Sample Input 1

Hey Joe
Jimmi Hendrix
4.8
true

Sample Output 1

<3 Jimmi Hendrix - Hey Joe
****

Sample Input 2

Whole Lotta Love
Led Zeppelin
4.6
false

Sample Output 2


Autoria: Gerard Falcó


Authorship: Gerard Falcó

CC BY-NC-SA 4.0