Advertisement
michael_xgrind

Garçom

Sep 12th, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.23 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Garcom {
  4.     public static void main(String args[]){
  5.         Scanner leia = new Scanner(System.in);
  6.         Scanner leia2 = new Scanner(System.in);    
  7.        
  8.         System.out.print("Entre com o nome do usuario: ");
  9.         String usuario = leia.next();
  10.         System.out.print("Entre com a senha: ");
  11.         String senha = leia.next();
  12.        
  13.         if ((usuario.equalsIgnoreCase("goku")) && (senha.equals("S3nh4"))) {
  14.             System.out.print("\nEntre com a palavra 1: ");
  15.             String palavra1 = leia.next().substring(0,1);
  16.             System.out.print("Entre com a palavra 2: ");
  17.             String palavra2 = leia.next().substring(0,1);
  18.             System.out.print("Entre com a palavra 3: ");
  19.             String palavra3 = leia.next().substring(0,1);
  20.            
  21.             System.out.print("\nEntre com o valor da conta: ");
  22.             double conta = leia2.nextFloat();
  23.             System.out.print("Entre com a quantidade de pessoas: ");
  24.             int pessoas = leia2.nextInt();
  25.            
  26.             if ((palavra1.equalsIgnoreCase("S")) && (palavra2.equalsIgnoreCase("I")) && (palavra3.equalsIgnoreCase("M"))) {
  27.                 System.out.printf("\nTotal: R$ %2.2f", (conta/pessoas) + conta*0.1);
  28.             }
  29.             else {
  30.                 System.out.printf("\nTotal: R$ %2.2f", (conta/pessoas));
  31.             }
  32.         }
  33.         else {
  34.             System.out.print("\nAcesso negado!");
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement