Design and implement a programming (name it NextMeeting) to determine the day of
ID: 3753050 • Letter: D
Question
Design and implement a programming (name it NextMeeting) to determine the day of your next meeting from today. The program read from the user an integer value representing the today’s day (assume 0 for Sunday, 1 for Monday, 2 for Tuesday, 3 for Wednesday, etc…) and another integer value representing the number of days to the meeting day. The program determines and prints out the meeting day. Format the outputs following the sample runs below.
Explanation / Answer
Java: ------ import java.util.Scanner; public class NextMeeting { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n1 = in.nextInt(); int n2 = in.nextInt(); String[] days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; System.out.println("Today is " + days[n1]); System.out.println("Days to the meeting is " + n2 + " days"); System.out.println("Meeting day is " + days[(n1+n2)%7]); } } C++: ------ #include #include using namespace std; int main() { int n1, n2; cin >> n1 >> n2; string days[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.