Libro
Submit solution
Points:
10
Time limit:
5.0s
Memory limit:
256M
Author:
Problem type
Allowed languages
C#, Go, Java, Python
Crea les classes Libro
i Autor
import java.util.Scanner;
// escriu el codi aqui
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Libro libro = new Libro();
libro.autor = new Autor();
libro.titulo = scanner.nextLine();
libro.ISBN = scanner.nextLine();
libro.rating = scanner.nextFloat();
scanner.nextLine();
libro.autor.nombre = scanner.nextLine();
libro.autor.rating = scanner.nextFloat();
System.out.println(libro.ISBN);
System.out.println(libro.titulo);
System.out.println(new String(new char[(int)libro.rating]).replace("\0","*"));
System.out.println(libro.autor.nombre);
System.out.println(new String(new char[(int)libro.autor.rating]).replace("\0","*"));
}
}
Input Format
-
Constraints
-
Output Format
-
Sample Input 0
C Programming Language
978-0131103627
4.5
Dennis M. Ritchie
5
Sample Output 0
978-0131103627
C Programming Language
****
Dennis M. Ritchie
*****
Sample Input 1
Expert C Programming: Deep C Secrets
978-0131774292
4.7
Peter van der Linden
5
Sample Output 1
978-0131774292
Expert C Programming: Deep C Secrets
****
Peter van der Linden
*****
Sample Input 2
C: A Reference Manual
978-0130895929
5
Samuel P. Harbison
5
Sample Output 2
978-0130895929
C: A Reference Manual
*****
Samuel P. Harbison
*****
Autoria: Gerard Falcó
CC BY-NC-SA 4.0