- 1

Can someone help me out.

Write a simple java program that will add two decimal numbers and y, the divided by a whole number if the result of division is less than five, the result is round of to a whole number and the number is greater than five the number is to round off to a whole number

15th Jul 2021, 8:34 PM
Dav Alf
6 odpowiedzi
+ 2
Considering it's homework, I agree with Ratnapal on this and believe you should at least attempt to utilize what you learned in the lectures. Or if not, don't be afraid to ask your teacher since that's the purpose of them. Breakdown: - Get input from user (2 decimal nums, 1 whole num) - Use variables to store the input - Work the rest out like normal math. ((x+y)/z) Use IF checks to test conditions and perform operations depending on if the condition is true or false. if(expression < 5){ do this } else { do that } Go to the Code Playground and at least try to work it out yourself. If you run into problems, save the code and post up a link so we can help you learn it. Simply giving you the answer isn't going to help you; you'll still have class/quiz/test/etc... after today and we won't be there to help you. Also, don't be afraid to talk with your teacher and have them further explain/tutor you on how to do something. It's not about passing a class, it's all about learning the material. Best of luck to you!
15th Jul 2021, 9:13 PM
Jakko Jak
Jakko Jak - avatar
+ 1
where is your attempt ?
15th Jul 2021, 8:35 PM
Ratnapal Shende
Ratnapal Shende - avatar
+ 1
Thanks let me try my attempt and I will post it for correction
15th Jul 2021, 9:23 PM
Dav Alf
0
I'm a beginner and this is what i was surprised with in my third lectures
15th Jul 2021, 8:41 PM
Dav Alf
0
Hello i have tried but I'm getting errors
21st Jul 2021, 8:55 PM
Dav Alf
0
Here is my try package assignment; public class dave { public static void main(String[] args) { int = x,y,z float x = 4.70; float y = 3.30; int = x+y/whole numer System.out.println("Sum of digits = "x+y/sum); { if ("float"x+y"/z"= to a whole number < five print true if ("float"x+y"/z" is > than five print false } }
21st Jul 2021, 8:56 PM
Dav Alf