1. Fill in the 1o blanks in the program below: The user enters a number. of days
ID: 3903739 • Letter: 1
Question
1. Fill in the 1o blanks in the program below: The user enters a number. of days that is converted into years, weeks, and days. sample run: Enter the number of days: 1000 1000 days 2 years 38 weeks 6 days java util Scanner; public class DayConventen ( public static void int System.out.print( "Enter the number of days:); System.out print ( days +"days"); (Stringl] ares) f input = new Scanner(System.in); weeks, days input . next!nt(); - days/ 7; days % 7; years weeks / weeks weeks % 52; .out print(years +"years "); System.out .print( + " weeks"); System.oult.print ?n(days + " days");
Explanation / Answer
As per your requirement i have written solution which fulfill all your requirements please follow it step by step.
Question 1
----------
Solutions for following blanks
1) import
Reason
------
Without import keyword we can't inlcude libraries
2) main
Reason
------
With main method we can run program
3) Scanner
Reason
------
To read from user we have Scanner class
4) years
Reason
------
Have to display years thats y we intilize years variable
5) days
Reason
------
Readed value have to assign to days variable
6) weeks
7) days
8) 52
9) System
Reason
------
To print on console have to System
10) weeks
Reason
------
We are displaying weeks along with days and years.
Question 2
----------
Outputs for following code snippets
1) 15
2) hello
Reason
------
Only if condition is satified.
3) here
there
Reason
------
Both if and else if conditions are excute
4) 16.5
5) 3.75
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.