Java Primitive Operators - Once in the bar | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Java Primitive Operators - Once in the bar

Hi, I'm trying to solve the code coach "Once in the bar" but its not working... "A bartender sold 64 bottles of beer and 23 bottles of whisky. You need to calculate how many total bottles are sold. Task Calculate and output the total number of sold bottles." this is my code: public class Program { public static void main(String[] args) { int beer = 64; int whisky = 23; //calculate the sum and output it int bottles = beer + whiskey; System.out.println(bottles); } } can someone help me and show me what I did wrong?

23rd Nov 2021, 9:49 AM
Jens
3 Answers
+ 2
In the line int whisky = 23; spelling of whisky is wrong
23rd Nov 2021, 9:54 AM
Ananya | Inactive |
Ananya | Inactive | - avatar
+ 2
You need to take input and assign the input values to the variables beer and whiskey. Review the Java lessons related to accepting input. Fix spelling errors on variables.
23rd Nov 2021, 9:56 AM
Paul K Sadler
Paul K Sadler - avatar
+ 2
oh yes my bad, thank you very much!
23rd Nov 2021, 9:57 AM
Jens