English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

write a program, called Kg, that converts the following integer values 5,40,85 and 120 kilograms to pounds (1lb= .454kg) and displays the result to the monitor. create 4 integer variables to hold the 4 kg values. similarly, you can create 4 double variables to hold the 4 ib values

2007-03-01 23:23:22 · 3 answers · asked by LULU 1 in Computers & Internet Programming & Design

SOLVE it with JAVA
Part B
Write a program, called Kg, that converts the following integer values 5, 40, 85 and 120 kilograms to pounds (1 lb = .454kg) and displays the result to the monitor. Create 4 integer variables to hold the 4 kg values. Similarly, you can create 4 double variables to hold the 4 lb values.

Sample output:

5 kg = 11.01 lb
40 kg = 88.10 lb
85 kg = 187.22 lb
120 kg = 264.31 lb

2007-03-02 00:21:26 · update #1

3 answers

u hav not mentioned the language in which u want this program written.
so i m giving u in C.

#include

double convert(int temp);

int akg=5, bkg=40, ckg=85, dkg=120;
double alb, blb, clb, dlb;

void main()
{
alb=convert(akg);
blb=convert(bkg);
clb=convert(ckg);
dlb=convert(dkg);
printf ("a=%d\tb=%d\tc=%d\td=%d", alb,blb,clb,dlb);
}

double convert(int temp)
{
return(temp*0.454)
}

2007-03-01 23:33:24 · answer #1 · answered by ravish2006 6 · 0 0

uhhhmmm.... with all due respect... what is your programming platform? you should specify which platform you are currently using so as to know which codes to use for the program.....

2007-03-01 23:30:30 · answer #2 · answered by xKaiSeRx 1 · 0 0

Shouldn't you be doing your own coursework and research for yourself?

2007-03-01 23:28:00 · answer #3 · answered by Carella 6 · 0 0

fedest.com, questions and answers