Forum Articles
  Welcome back Join CF
You are here You are here: Home | Forum | Internet Explorer 9 Released

You are currently viewing our boards as a guest which gives you limited access to view most of the discussions, articles and other free features. By joining our Virgin Media community you will have full access to all discussions, be able to view and post threads, communicate privately with other members (PM), respond to polls, upload your own images/photos, and access many other special features. Registration is fast, simple and absolutely free so please join our community today.


Welcome to Cable Forum
Go Back   Cable Forum > Computers & IT > General IT Discussion
Register FAQ Community Calendar

Simple Java Program
Reply
 
Thread Tools
Old 20-09-2011, 11:02   #1
cnewton2k
Inactive
 
Join Date: Mar 2005
Location: North
Age: 44
Services: 100 Meg + Phone
Posts: 945
cnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of light
Send a message via MSN to cnewton2k
Simple Java Program

Hi,

I have just started at uni doing a BSc in Applied Computing and Multimedia.

We started on programming and i have been given a task to write a simple java program :

Write a program that converts 3.5 miles into inches using the following criteria.

3.5 * 1760 = 6160 yards 6160 * 3 = 18480 feet 18480 * 12 = 221760 inches

I have started in Netbeans and have done the following the following

package distance;

/**
*
* @author s0144037
*/
public class Main {

/**
* @param args the command line arguments
*/
public static void Main(String[] args) {
double mile = 3.5;
double yard = mile * 1760;
double feet = yard * 3;
double inches = feet * 12;

System.out.println("3.5 Miles Converted into inches" = mile * yard * feet + inches);

}
}

Now when i try and run the it i get the error "No Main Classes Found".

I am not sure where i have gone wrong or even if i am on the right track!

If anyone could help explain that would be amazing

Thanks
cnewton2k is offline   Reply With Quote
Advertisement
Old 20-09-2011, 11:07   #2
downquark1
cf.mega poster
 
Join Date: Jun 2003
Age: 38
Services: Plusnet FFTC
Posts: 4,938
downquark1 has a bronzed appealdownquark1 has a bronzed appeal
downquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appeal
Re: Simple Java Program

will try the main error in a moment:

for starters:

System.out.println("3.5 Miles Converted into inches" = mile * yard * feet + inches);

The = needs to be within the string and you need a string appending operator, in java I think its + but not sure so it should be

System.out.println("3.5 Miles Converted into inches = " + (mile * yard * feet + inches));

But I'm currently thinking in C++ so may get a bit wrong.
__________________
"Knowledge is Power. Power Corrupts. Study Hard. Be Evil."
downquark1 is online now   Reply With Quote
Old 20-09-2011, 11:12   #3
cnewton2k
Inactive
 
Join Date: Mar 2005
Location: North
Age: 44
Services: 100 Meg + Phone
Posts: 945
cnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of light
Send a message via MSN to cnewton2k
Re: Simple Java Program

I have changed that and as soon as i read it i realised what i had done wrong.

However it is still saying "no main classes found"

Thanks for your help with this
cnewton2k is offline   Reply With Quote
Old 20-09-2011, 11:17   #4
downquark1
cf.mega poster
 
Join Date: Jun 2003
Age: 38
Services: Plusnet FFTC
Posts: 4,938
downquark1 has a bronzed appealdownquark1 has a bronzed appeal
downquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appealdownquark1 has a bronzed appeal
Re: Simple Java Program

ok found the problem.

public static void Main(String[] args) {

to


public static void main(String[] args) {
__________________
"Knowledge is Power. Power Corrupts. Study Hard. Be Evil."
downquark1 is online now   Reply With Quote
Old 20-09-2011, 11:22   #5
cnewton2k
Inactive
 
Join Date: Mar 2005
Location: North
Age: 44
Services: 100 Meg + Phone
Posts: 945
cnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of lightcnewton2k is a glorious beacon of light
Send a message via MSN to cnewton2k
Re: Simple Java Program

doh!

we where told yesterday about capitals lol!

It finally works thank you ever so much i really do appreciate it

At least i was on the right track!
cnewton2k is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 14:46.


Server: osmium.zmnt.uk
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum