Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import acm.program.*;
- public class erg1 extends Program {
- public void run() {
- println("?o programma ayto ypologizei tis meres poy perasan apo shmera apo mia parelthontikh hmeromhnia kathws k thn poia htan h mera thn hmeromhnia poy epileksate");
- println("Smhera");
- int ims = readInt("Mera se arithmo: "); //?µe?a
- int mins = readInt("Mhnas se arithmo: "); //???a?
- int xrs = readInt("Xronos: "); // ??????
- println("Parakatw epilekste mia parelthontikh hmeromhnia gia na ypologisete tis meres poy exoyn perasei: ");
- int im = readInt("Mera se arithmo: "); //?µe?a
- int min = readInt("Mhnas se arithmo: "); //???a?
- int xr = readInt("Xronos: "); // ?????
- //Etsi doyleyeis me synarthseis poy exoyn return
- int synoloImerwn = hmtoymhna(min);
- if(synolImerwn != -1){
- println("Egine kapoio lathos");
- }
- }
- private int hmtoymhna(int x){
- switch(x){
- case 1:
- case 3:
- case 5:
- case 7:
- case 8:
- case 10:
- case 12:
- return 31;
- case 4:
- case 6:
- case 9:
- case 11:
- return 30;
- case 2:
- return 28;
- default:
- return -1;
- }
- }
- }
Add Comment
Please, Sign In to add comment