Advertisement
Guest User

פרק 3 שאלה 3

a guest
Nov 18th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.15 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Targil2 {
  4.     public static void main(String[] args) {
  5.         Scanner s=  new Scanner (System.in);
  6.  
  7.      final int family=1000;
  8.      final int friends=500;
  9.      final int elsefriends=250;
  10.      int yeers=3;
  11.      int know;
  12.      int totalfriends=0;
  13.       int totalelsefriends = 0;
  14.       int drive;
  15.  
  16.         System.out.println("how much time you know the family?");
  17.         know=s.nextInt();
  18.         if (know>=yeers) {
  19.             totalfriends = friends + 50;
  20.             totalelsefriends = elsefriends + 50;
  21.  
  22.         }
  23.         else {
  24.             totalelsefriends=250;
  25.             totalfriends=500;
  26.         }
  27.         System.out.println("how much time drive to wedding?");
  28.         drive=s.nextInt();
  29.         if (drive>=1){
  30.             totalelsefriends=friends-50;
  31.             totalelsefriends=elsefriends-50;
  32.  
  33.         }
  34.         else {
  35.             totalelsefriends=totalelsefriends;
  36.             totalfriends=totalfriends;
  37.         }
  38.         System.out.println("you need to put if your are friends"+""+totalfriends+"if you are else friend"+totalelsefriends+"if you are family"+family);
  39.         }
  40.  
  41.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement