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.

14th Sep 2019, 10:18 AM
Iqbal Apipah Noer
Iqbal Apipah Noer - avatar
15 ответов
14th Sep 2019, 12:03 PM
Prathvi
Prathvi - avatar
+ 2
Please show us your attempt.
14th Sep 2019, 10:36 AM
HonFu
HonFu - avatar
14th Sep 2019, 11:24 AM
Prathvi
Prathvi - avatar
+ 1
Today is saturday , change the day in calendar
14th Sep 2019, 11:33 AM
Prathvi
Prathvi - avatar
+ 1
c is object of class Calendar , set day of week 6 means Firday https://code.sololearn.com/ck8u7jqSO4Hx/?ref=app
14th Sep 2019, 11:45 AM
Prathvi
Prathvi - avatar
+ 1
But in my country today is saturday
14th Sep 2019, 11:52 AM
Prathvi
Prathvi - avatar
+ 1
Again try and Try to put some logic on you too
14th Sep 2019, 12:12 PM
Prathvi
Prathvi - avatar
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"); } } } }
14th Sep 2019, 10:38 AM
Iqbal Apipah Noer
Iqbal Apipah Noer - avatar
0
Day in French. I am confused. if input 1-7 I can
14th Sep 2019, 10:39 AM
Iqbal Apipah Noer
Iqbal Apipah Noer - avatar
0
what if today has been determined? Friday
14th Sep 2019, 11:30 AM
Iqbal Apipah Noer
Iqbal Apipah Noer - avatar
0
I am still confused. what if our day is determined. c command for what?
14th Sep 2019, 11:36 AM
Iqbal Apipah Noer
Iqbal Apipah Noer - avatar
0
thanks, what code if you don't use calendar class? because the day is also known as Friday?
14th Sep 2019, 11:51 AM
Iqbal Apipah Noer
Iqbal Apipah Noer - avatar
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
14th Sep 2019, 11:54 AM
Iqbal Apipah Noer
Iqbal Apipah Noer - avatar
0
if modulo = 0 then the results are unknown? example I input 29
14th Sep 2019, 12:09 PM
Iqbal Apipah Noer
Iqbal Apipah Noer - avatar
0
Very thanks, Hello_World
14th Sep 2019, 2:00 PM
Iqbal Apipah Noer
Iqbal Apipah Noer - avatar