473,320 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

I need help on my first JAVA program

I am taking a class on JAVA this semester and was given my first assignment this week. But I am getting an error and I can't figure out what is causing it.

here is my code:

public class ShowOperations
{
public static void main(String [] args)
{
System.out.println("The total of 3 * 5 is " + (3 * 5) + '\n'
+ "The total of 7.1 * 8.3 - 2.2 is " + (7.1 * 8.3 - 2.2) + '\n'
+ "The total of 3.2 / (6.1 * 5) is " + (3.2 / (6.1 * 5)) + '\n'
+ "The total of 15 / 4 is " + (15 / 4) + '\n'
+ "The total of 15% of 4 is " + (15 % 4) + '\n'
+ "The total of 5 * 3 - (6 * 4) is " (5 * 3 - (6 * 4)) + '\n' );
}
}

The error is saying it was expecting a ')' before the last equation but it looks fine to me. All the '(' have closing ')'

am I making a noob mistake somewhere?
Feb 4 '06 #1
3 2784
nevermind i figured it out...i was missing a + before my last equation. gosh its always the simplest thing.
Feb 4 '06 #2
Niheel
2,460 Expert Mod 2GB
Yes those little mistakes make programming really fun!
Feb 4 '06 #3
You missed a + in the last line:
+ "The total of 5 * 3 - (6 * 4) is " + (5 * 3 - (6 * 4)) + '\n' );

I am taking a class on JAVA this semester and was given my first assignment this week. But I am getting an error and I can't figure out what is causing it.

here is my code:

public class ShowOperations
{
public static void main(String [] args)
{
System.out.println("The total of 3 * 5 is " + (3 * 5) + '\n'
+ "The total of 7.1 * 8.3 - 2.2 is " + (7.1 * 8.3 - 2.2) + '\n'
+ "The total of 3.2 / (6.1 * 5) is " + (3.2 / (6.1 * 5)) + '\n'
+ "The total of 15 / 4 is " + (15 / 4) + '\n'
+ "The total of 15% of 4 is " + (15 % 4) + '\n'
+ "The total of 5 * 3 - (6 * 4) is " (5 * 3 - (6 * 4)) + '\n' );
}
}

The error is saying it was expecting a ')' before the last equation but it looks fine to me. All the '(' have closing ')'

am I making a noob mistake somewhere?
Feb 6 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Chad | last post by:
I need my java program to exec an external .exe file, but the problem is that this program being exec()'ed prompts the user for two pieces of information. I am trying to get my java program to...
1
by: Stephen Ferg | last post by:
I'm trying to use telnetlib to run a Java program on a remote server. I'm having strange problems, and I'm wondering if anyone might be able to help. I have two UNIX servers, A and Z. I have...
10
by: pcbutts1 | last post by:
Yes this is a homework assignment. My instructor has broken english and I just could not follow along last night. How do I do this Write the program in Java (without a graphical user interface)...
1
by: Unebrion | last post by:
Alright im working on a program that prints out user imput in a frame, along with a barcode.. it is like the front of an envelope. Here is the description for the program. This...
0
by: south622 | last post by:
I'm taking a beginning Java course and I'm stuck in week eight of a nine week course. If anyone could help me I would greatly appreciate it. This assignment was due yesterday and each day I go past...
1
by: twin2003 | last post by:
need help with inventory part 5 here is what I have to do Modify the Inventory Program by adding a button to the GUI that allows the user to move to the first item, the previous item, the next...
1
by: feathers75 | last post by:
-------------------------------------------------------------------------------- First, Hello eveyone and I am new to Java. I am trying to create a Java program that will calculate a person...
8
by: garyrowell | last post by:
I have been at this programme for hours trying to work out what is wrong. Any help would be very much appricated. Here is the breif I received. The program This week you are going to write three...
3
by: 100grand | last post by:
Modify the Inventory Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.