Thanks: 0
Results 1 to 9 of 9
-
who wants to do my homework for me?
i am very frustrated right now!!!!!
Instructions:
Purpose: Demonstrate the ability to create and execute a JAVA program utilizing basic, elementary JAVA statements.
Assignment: Write a program that calculates a car’s gas mileage. Accept from the keyboard the number of gallons consumed on the trip, the starting mileage for the trip and the ending mileage for the trip. Calculate the miles per gallon and print all the data in a clear format on the screen.
that is only my second assignment in my first java programming class... how wicked
i got a 100 on my first program assignment tho!! :big grin:
(yes i did it all on my own)
this is a half serious and a half joke thread. you don't have to help and i should do it myself.
but i want help and i don't wanna do it myself.... hehe"Frankly, my dear, I don't give a damn."
-
09-16-2003, 08:49 PM #2
- Join Date
- Sep 2001
- Location
- No place like 127.0.0.1
- Posts
- 1,399
- Credits
- 1,103
hehe i could help you cause i did java last term.. but i am too lazy to remember the syntax
but it would look something like this is
var start_mileage; /* here you would put form data */
var end_mileage; /* and here */
var gallons; /* and here */
var mileage; /*these are worked out later */
var answer; /*and this */
mileage = end_mileage - start_mileage;
answer = mileage / gallons;
then you would either create an alert
alert(answer);
to display or have it displayed in a form! up to you
hope that sorta helps its been a year since i looked at java code and im rusty
[My Top 20 Movies@Ymdb] - ([)(]) Dolby Digital the choice of ML's - [~My Place ~]
{Drag The Sunrise Down: You know the light can hypnotise, so shut it out and close your eyes - Rooster}
-
-
-
awwww Jake!!
well thanks for trying everybody!!
but i got it now..
/* Program that calculates a car’s gas mileage
Stephanie Bradley
CS 1315 Assignment #2
*/
import javax.swing.JOptionPane;
public class Assignment2
{
public static void main(String[]args)
{
double gallons = 0;
double gasMileage = 0;
double startingMileage = 0;
double endingMileage = 0;
//Prompt the user to enter the gallon
String gallonsString = JOptionPane.showInputDialog(null, "Enter the gallons",
"Input Dialog Demo", JOptionPane.QUESTION_MESSAGE);
//Prompt the user to enter the starting mileage
String startingMileageString = JOptionPane.showInputDialog(null, "Enter the starting mileage" ,
"Input Dialog Demo", JOptionPane.QUESTION_MESSAGE);
//Prompt the user to enter the ending mileage
String endingMileageString = JOptionPane.showInputDialog(null, "Enter the ending mileage",
"Input Dialog Demo", JOptionPane.QUESTION_MESSAGE);
//Assign gasMileage
gallons = Double.parseDouble(gallonsString);
startingMileage = Double.parseDouble(startingMileageString);
endingMileage = Double.parseDouble(endingMileageString);
gasMileage = (endingMileage - startingMileage) / gallons;
//Display results
JOptionPane.showMessageDialog(null,"The miles per gallons are " + gasMileage,
"Assignment #2 Output", JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
sorry jake... i can't do your homework now since you didn't do this for me
and yes I did that all by myself!! :big grin: (no applause please)
-
Looks like I'm too late, and can only program in BASIC anyway
oh yeah...feel the power of my real-world skills.
-
09-20-2003, 01:40 AM #7
- Join Date
- Sep 2001
- Location
- No place like 127.0.0.1
- Posts
- 1,399
- Credits
- 1,103
hehe its right marcus.. i realised my tip was done for javascript not java hehe..
-
made an A in this course! wooooooohooooooo!!!!!!!!!!!
-
Congrat, you cheater you. j/k
Last edited by editman; 12-15-2003 at 09:41 PM.
"The idea was to be a symbol. editman could be anybody, that was the point."
Trolls destroyed the Forum
my DVD/blu-ray List
Bookmarks