0

Emma's boss needs to know how much time they have to prepare for certain important events. Emma created a spreadsheet with the n

This is the code provided, I have edited and put in my code but the output keeps saying I have to convert private static void process(String input) to an integer. import java.io.*; import java.util.*; public class Main { //COMPLETE THIS FUNCTION private static void process(String input) { System.out.println(input); } //you do not need to edit any code below this line public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String input = scanner.nextLine(); process(input); } }

11th Sep 2022, 4:51 PM
Ukeme
7 Answers
+ 3
Ukeme please show us what you have done .. You have provided what the task personnel have given. We are not here to do your work / homework assignment for you. btw I think Emma should be doing her own assignment as well but she obviously dropped it in your hands believing you are capable of helping her.
11th Sep 2022, 5:02 PM
BroFar
BroFar - avatar
+ 2
I copied it into code playground and it works fine for me, assuming you enter a string and want that string output.
11th Sep 2022, 4:59 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Please do not put the task description in the title section. It gets cut off and we cannot read it.
11th Sep 2022, 4:56 PM
Lisa
Lisa - avatar
+ 1
input is in String form. Task is Convert it to integer type.. (add lesson number...) How? Integer class has valueOf() method, which will be explained in lessons.. Revise those...
11th Sep 2022, 5:21 PM
Jayakrishna 🇼🇳
+ 1
Ukeme as far as converting a String to an integer int makeANumber = Integer.parseInt(input); System.out.println(makeANumber);
11th Sep 2022, 5:58 PM
BroFar
BroFar - avatar
+ 1
Ukeme This will run but your calculations are wrong. For what ever input, you get output as 4 weeks, 4 days. It because 32/7=4 weeks , and 32%7=4 days.. ( 32%365= 32 only) and days = 32 will reset input value to 32. What is your actual task here..? What's your input..? And what conversions you need? edit: add lesson or task number if it about days to weeks then, it should be days / 7 weeks, days% 7 days remains.
13th Sep 2022, 9:12 PM
Jayakrishna 🇼🇳
0
This is what I wrote but it is not running as in its keeps saying compiled successfully but doesn't produce an output. Thank you so much for your contributions import java.io.*; import java.util.*; public class DaysConverter { private static void process(String input) { int days = Integer.parseInt(input); System.out.println(days); days = 32; //Emma's weeks and days conversion int weeks = (days % 365) / 7; days = (days % 365) % 7; //print number of weeks and remaining days in given number of days System.out.println( weeks+" weeks"+ " + " + days +" days"); } //you do not need to edit any code below this line public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String input = scanner.nextLine(); process(input); } }
13th Sep 2022, 8:40 PM
Ukeme