Advertisement
alandmx40

Atividade - Classe Livro

Jul 7th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.70 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. /**
  8.  *
  9.  * @author Aluno
  10.  */
  11. import java.util.Scanner;
  12.  
  13. public class Livro {
  14.    
  15.     private String titulo;
  16.     private String autor;
  17.     private String genero;
  18.     private double preco;
  19.     double reaj;
  20.    
  21.     public String getTitulo(){
  22.         return titulo;
  23.     }
  24.    
  25.     public void setTitulo(String titulo){
  26.         this.titulo = titulo;
  27.     }
  28.    
  29.     public String getNome(){
  30.         return autor;
  31.     }
  32.    
  33.     public void setNome(String autor){
  34.         this.autor = autor;
  35.     }
  36.    
  37.     public String getGenero(){
  38.         return genero;
  39.     }
  40.    
  41.     public void setGenero(String genero){
  42.         this.genero = genero;
  43.     }
  44.    
  45.     public double getPreco(){
  46.         return preco;
  47.     }
  48.    
  49.     public void setPreco(double preco){
  50.         this.preco = preco;
  51.     }
  52.    
  53.     void visualizarDados(){
  54.        
  55.         System.out.println("Titulo"+titulo);
  56.         System.out.println("Autor"+genero);
  57.         System.out.println("");
  58.         System.out.println("");
  59.     }
  60.    
  61.     void reajustarPreco(double f){
  62.         Scanner e = new Scanner(System.in);
  63.        
  64.         System.out.println("Digite o novo valor do livro:");
  65.         reaj = e.nextDouble();
  66.        
  67.         f = (reaj*preco) + preco;
  68.        
  69.         this.setPreco(f);
  70.     }
  71.    
  72.     public Livro(String titulo, String autor, String genero, float preco){
  73.        
  74.         this.titulo = titulo;
  75.         this.autor = autor;
  76.         this.titulo = autor;
  77.         this.preco = preco;
  78.        
  79.     }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement