/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package enrajolar;
import java.util.Scanner;
/**
*
* @author Sergi
*/
public class Enrajolar {
public static final double preu1 = 16.27;
public static final double preu2 = 14.12;
public static final double preu3 = 13.20;
public static void main(String[] args) {
// TODO code application logic here
Scanner lector = new Scanner(System.in);
//Entra al menu de opcions
System.out.println("Quina opció vols de rajola? ");
System.out.println("[1] Dimensió 0,60x0,60m");
System.out.println("[2] Dimensió 0,50x0,50m");
System.out.println("[3] Dimensió 0,45x0,45m");
System.out.println("Selecciona l'opció [1-3]: ");
int opcio = lector.nextInt();
lector.nextLine();
if (opcio==1){
System.out.print("Opcions de compra");
System.out.print("____");
System.out.print("Introdueix la llargada de la habitació: ");
float llargada = lector.nextFloat();
lector.nextLine();
System.out.print("Introdueix la amplada de la habitació: ");
float ampla = lector.nextFloat();
lector.nextLine();
float metres = llargada * ampla;
double x = llargada /(60/100);
double y = ampla / (60/100);
double rayola = x*y;
double total = rayola*preu1;
System.out.print("Per enrajolar una habitacio de " + metres);
System.out.print("es necesiten :" +rayola+ "de tipus 1 ");
System.out.print("Y el seu cost total es:" +total);
}
else if (opcio==2){
System.out.print("Opcions de compra");
System.out.print("____");
System.out.print("Introdueix la llargada de la habitació: ");
float llargada = lector.nextFloat();
lector.nextLine();
System.out.print("Introdueix la amplada de la habitació: ");
float ampla = lector.nextFloat();
lector.nextLine();
float metres = llargada * ampla;
double x = llargada /(60/100);
double y = ampla / (60/100);
double rayola = x*y;
double total = rayola*preu2
System.out.print("Per enrajolar una habitacio de " + metres);
System.out.print("es necesiten :" +rayola+ "de tipus 1 ");
System.out.print("Y el seu cost total es:" +total);
}
else if (opcio==3){
System.out.print("Opcions de compra");
System.out.print("____");
System.out.print("Introdueix la llargada de la habitació: ");
float llargada = lector.nextFloat();
lector.nextLine();
System.out.print("Introdueix la amplada de la habitació: ");
float ampla = lector.nextFloat();
lector.nextLine();
float metres = llargada * ampla;
double x = llargada /(60/100);
double y = ampla / (60/100);
double rayola = x*y;
double total = rayola*preu3;
System.out.print("Per enrajolar una habitacio de " + metres);
System.out.print("es necesiten :" +rayola+ "de tipus 1 ");
System.out.print("Y el seu cost total es:" +total);
}
else{
System.out.print("Error en el valor introduit ");
}
}
}