DevX Home Today's Headlines   Articles Archive   Tip Bank   Forums

1. Registered User
Join Date
May 2004
Posts
4

## 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.

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

3. Registered User
Join Date
May 2004
Posts
4
Well so far what I have is the following:
import java.io.*;
import java.lang.Math;
import java.text.DecimalFormat;

public class Final
{
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);
System.out.println("Now enter another number for weight of plane in lbs(A)" + A);
System.out.println("Enter a different number for air density(p)" + p);
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.

4. 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
{
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=' ';

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(true)
{
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:
break;
}

{

System.out.println("Now enter a value for speed(V)" + V);
System.out.println("Now enter another number for weight of plane in lbs(A)" + A);
System.out.println("Enter a different number for air density(p)" + p);
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);
}
}
}
Last edited by JGRobinson; 05-15-2004 at 03:12 PM.

5. Registered User
Join Date
May 2004
Posts
4
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
•

 FAQ Latest Articles Java .NET XML Database Enterprise