Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Isn;
- public class ex4 {
- public static void main (String[]args) {
- {
- System.out.print("type de lettre (0=verte, 1=prioritaire, 2=ecopli) :");
- int typeLettre = Integer.parseInt(System.console().readLine());
- System.out.print("Poids :");
- float poids = Float.parseFloat(System.console().readLine());
- System.console.printLn(prix(typeLettre,poids));
- }
- }
- int prix(int type, float poids)
- {
- if(poids <= 20)
- {
- if(type == 0)
- {
- return 0.57;
- }
- else if(type==1)
- {
- return 0.6;
- }
- else if(type==2)
- {
- return 0.55;
- }
- }
- else if(poids > 20 && poids <= 50)
- {
- if(type == 0)
- {
- return 0.95;
- }
- else if(type==1)
- {
- return 1.0;
- }
- else if(type==2)
- {
- return 0.78;
- }
- }
- else if(poids <= 100)
- {
- if(type == 0)
- {
- return 1.4;
- }
- else if(type==1)
- {
- return 1.45;
- }
- else if(type==2)
- {
- return 1.0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement