0
Code Coach Problem(Fruit Bowl)
I canât seem to work out how to integrate my code with the code thatâs already there, can anyone help me with this please?
10 Respostas
+ 7
Java's output statement is
System.out.println(fruit) ;
System.out.print(fruit) ; //this don't put newline after, but above does...
Not document.write(); //this is in JavaScript..
Read before attempting for a good practice:
See this in System.out.println topic(3rd)
https://www.sololearn.com/learn/Java/2137/?ref=app
+ 2
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int fruit = input.nextInt();
int apple,banana,pie;
//your code goes here
if(fruit>6){
apple=fruit/2;
pie=apple/3;
System.out.println(pie);
}
else
System.out.println("0");
}
}
+ 1
Write Program and hit run. You will see in output part.. It will show 2 examples with expected output. With the output you are getting.. Remaing are hidden..
+ 1
Thank you so much đđđ»
0
It had built the read input line.
You focus on the calculations.
At last, print the result to console.
0
You just need to continue...
After
// your code goes here...
Write logic here... Complete program.
0
Thank you, how can i output my calculations?
0
It doesnt allow me to use document.write() or return, is there another thing i can try?
0
This is my code
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int fruit = input.nextInt();
fruit /= 2;
fruit /= 3;
}
}
Is fruit the right varible to use?
0
Wel come... Shania