-
Urgent help
I need help to design a program that will help me do the following:
determine the drag force of five different types of airplanes this is determined by user inputs such as speed(V), drag force(D), coefficient of drag, or drag coefficient, which is unitless(C), area of the plane(A), and air densty(P). The types of planes are as followed: SR-71 Blackbird(s), Cropduster(o), AirlinerTu-134A(l), private jet Yak-40D(y), and the Space ShuttleEndeavor OV-105(e).
variables have to be V,D,C,A,P as part of the formula and s,o,l,y,e to represent the planes.
Formula HAS to be as followed D = (1/2)*C*A*p*(V^2).
Any help will be greatly appreciated and this is a very urgent program so thanks to anyone who can help.
-
More info needed
Hi Spyderone,
I cannot really tell from the post
what problem you need help with.
As far as I can gather from the information
provided you get the information entered
by the user, and you know the formula.
I don't really understand how the planes
and the letters for those planes fit it.
Can you try and repost highlighting the
particular area you are having difficulty with. so that I might be able to help.
Sorry
Hope this helps
Graham
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, and if they get mad, you are a mile away and you have their shoes ;-)
http://www.grahamrobinsonsoftware.com
-
Well so far what I have is the following:
import java.io.*;
import java.lang.Math;
import java.text.DecimalFormat;
public class Final
{
static BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws IOException
{
char y = 0;
char n = 0;
double b = 0;
char s = 0;
char o = 0;
char l = 0;
char k = 0;
char e = 0;
double D = 0;
double C = 0;
double A = 0;
double p = 0;
double V = 0;
char x='s';
System.out.println("In this program I intend to determine the drag of five different types of airplanes " +
"this is determined by user inputs such as\n speed(V), drag force(D)this is what is being sloved , coefficient of drag," +
" or drag coefficient, which is unitless(C), weight of the plane(A), and air densty(P)." +
"\n The types of planes are as followed: SR-71 Blackbird(s), PT-17 bi-plane (o), AirlinerTu-134A(l)," +
" private jet Yak-40D(k),\n and the Space ShuttleEndeavor OV-105(e). Formula is as followed D = (1/2)*p*(V^2)/A.");
System.out.println("Which type of plane would you like to use s(SR-71 Blackbird), o(Cropduster), l(AirlinerTu-134A),\n y(private jet Yak-40D), e(Space ShuttleEndeavor OV-105)? " + x);
while(x=='s')
{
System.out.println("You have choosen the SR-71 Blackbird.");
System.out.println("Now enter a value for speed(V)" + V);
V = Double.parseDouble(keyboard.readLine());
System.out.println("Now enter another number for weight of plane in lbs(A)" + A);
A = Double.parseDouble(keyboard.readLine());
System.out.println("Enter a different number for air density(p)" + p);
p = Double.parseDouble(keyboard.readLine());
D = (0.5)*p*(Math.pow(V, 2)/A);
System.out.println("The total drag force created is " +D+" mph of drag.");
}
}
}
what I can't do is let the program allow me to use a different plane, Yes, I'm aware that other options arn't shown here but this is just a shorten example.
-
Hi,
You need to get the input for the new plane.
I have make some amendments to
the program below.
see if it helps.
Cheers
Graham.
public class Final
{
static BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws IOException
{
boolean isBadItem = false;
char y = 0;
char n = 0;
double b = 0;
char s = 0;
char o = 0;
char l = 0;
char k = 0;
char e = 0;
double D = 0;
double C = 0;
double A = 0;
double p = 0;
double V = 0;
char x=' ';
System.out.println("In this program I intend to determine the drag of five different types of airplanes " +
"this is determined by user inputs such as\n speed(V), drag force(D)this is what is being sloved , coefficient of drag," +
" or drag coefficient, which is unitless(C), weight of the plane(A), and air densty(P)." +
"\n The types of planes are as followed: SR-71 Blackbird(s), PT-17 bi-plane (o), AirlinerTu-134A(l)," +
" private jet Yak-40D(k),\n and the Space ShuttleEndeavor OV-105(e). Formula is as followed D = (1/2)*p*(V^2)/A.");
System.out.println("Which type of plane would you like to use s(SR-71 Blackbird), o(Cropduster), l(AirlinerTu-134A),\n y(private jet Yak-40D), e(Space ShuttleEndeavor OV-105)? " + x);
x = keyboard.readLine().charAt(0);
while(true)
{
isBadItem = false;
switch(x)
{
case 's':
System.out.println("You have choosen the SR-71 Blackbird.");
break;
case 'y':
System.out.println("You have choosen the private jet");
break;
default:
System.out.println("Invalid Item, Please reselect");
isBadItem = true
break;
}
if(!isBadItem)
{
System.out.println("Now enter a value for speed(V)" + V);
V = Double.parseDouble(keyboard.readLine());
System.out.println("Now enter another number for weight of plane in lbs(A)" + A);
A = Double.parseDouble(keyboard.readLine());
System.out.println("Enter a different number for air density(p)" + p);
p = Double.parseDouble(keyboard.readLine());
D = (0.5)*p*(Math.pow(V, 2)/A);
System.out.println("The total drag force created is " +D+" mph of drag.");
}
System.out.println("Which type of plane would you like to use s(SR-71 Blackbird), o(Cropduster), l(AirlinerTu-134A),\n y(private jet Yak-40D), e(Space ShuttleEndeavor OV-105)? " + x);
x = keyboard.readLine().charAt(0);
}
}
}
Last edited by JGRobinson; 05-15-2004 at 03:12 PM.
Hope this helps
Graham
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, and if they get mad, you are a mile away and you have their shoes ;-)
http://www.grahamrobinsonsoftware.com
-
Hey thanks alot I ran the program and it worked great thanks alot.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks