0
Java to calculate Days. The program will ask for an integer N, then displays the name of the day that falls N days after today
Java to calculate Days. The program will ask for an integer N, then displays the name of the day that falls N days after today. today is Friday. Help me make the program. Example: Input : 2 Output : Sunday Because today is Friday, then 2 days again is Sunday. Example 2: Input : 7 Output : Monday Because today is Friday, then 17 days are Monday.
15 Answers
+ 2
Please show us your attempt.
+ 1
Today is saturday ,
change the day in calendar
+ 1
c is object of class Calendar ,
set day of week 6 means Firday
https://code.sololearn.com/ck8u7jqSO4Hx/?ref=app
+ 1
But in my country today is saturday
+ 1
Again try and Try to put some logic on you too
0
package com.company;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Masukan Angka (Hari) :");
int hari = scanner.nextInt();
int jumat = hari + 5;
int jumat2 = jumat % 7;
System.out.println(jumat2);
switch (hari) {
case 1:
System.out.println("lundi");
break;
case 2:
System.out.println("mardi");
break;
case 3:
System.out.println("jeudi");
break;
case 4:
System.out.println("vendredi");
break;
case 5:
System.out.println("samedi");
break;
case 6:
System.out.println("dimanche");
break;
case 7:
System.out.println("juillet");
}
}
}
}
0
Day in French. I am confused. if input 1-7 I can
0
what if today has been determined? Friday
0
I am still confused. what if our day is determined. c command for what?
0
thanks, what code if you don't use calendar class? because the day is also known as Friday?
0
if no calendar class. What is the code like? because this is a matter of my college lessons. and the time is fixed on friday
0
if modulo = 0 then the results are unknown? example I input 29
0
Very thanks, Hello_World