| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 417 人关注过本帖
标题:英文编程 不知它想干嘛
只看楼主 加入收藏
wu47589791
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2009-10-12
结帖率:66.67%
收藏
已结贴  问题点数:10 回复次数:2 
英文编程 不知它想干嘛

You need to write three C programs that allow user to perform conversion. Your
programs should be able to perform nine types of conversion as shown in table below:

Code Convert Ratio
1 feet into meters 0.3048
2 nautical miles into kilometers 1.852
3 cubic inches into liters 0.016387
4 gallons into liters 4.54609
5 acres into square meters 4046.8564
6 pounds into kilograms 0.4535924
7 tons into kilograms 1016.0469
8 horsepower into watts 745.7
9 horsepower into metric horsepower 1.01387

This assignment consists of three parts:

Part A

You should design your program in such a way that:

a) The conversion ratios are predefined and stored in variables of the type
double. For example:
double FtoM = 0.3048; // Ratio for converting feet into meter
double MtoKM = 1.852; // Ratio for converting mile into kilometer

b) User inputs a conversion request which consists of a code representing the
type of conversion and an amount to be converted.
For example: 1 2000 represents a request to convert 2,000 feet into its
equivalence in meters.

c) Your program will perform the conversion based on the predefined ratios and
prints the converted amount (to 2 decimal places) on the screen.

Following is a sample of the input and output for the scenario.

1 2000


609.60


Version 3.0

 
Part B
Using a new program source file, modify your program in Part A to allow user to
indicate the number of conversions to be performed, and to receive conversion
requests in terms of a pair of code and amount to be converted.

The flow of the program is as follows.

a) User inputs the number of conversions to be performed. (maximum 5)

b) User inputs a conversion request with code and amount to be converted.

c) Your program should perform the conversion based on the input entered by
user in step (b) and output on the screen with message shown in the example
below. Both the input amount and the converted amounts will be printed to 2
decimal places.

Note:
Use the vocabulary in column 2 of table (page 1) to transform into wordings
for the output message.


d) Repeat steps (b) and (c) for the number of conversion requests as entered by
user in step (a).

Following is a sample of the input and output for the scenario.

2
1 2000
2000.00 feet equivalent to 609.60 meters


4 79.5
79.50 gallons equivalent to 361.41 liters
Version 3.0

 
Part C
Using a new program source file, modify your program in Part B to allow user to
indicate the number of conversions to be performed, to receive conversion requests,
and to produce output in tabular format.

The flow of the program is as follows.
a) User inputs the number of conversions to be performed. (maximum 5)
b) User inputs a conversion request with code and amount to be converted.
c) Repeat step (b) for the number of conversion requests entered by user in step

(a).
d) Your program should perform the conversion based on the input entered by
user in step (b).
e) Output to the screen using the table format shown in the sample output below.
The last three print columns should be printed to 2 decimal places.

Note:
Use print tab (\t) to generate the tabular output.


f) Repeat steps (d) and (e) for the number of conversion requests entered by user
in step (a).

Following is a sample of the input and output for the scenario.

2
1 2000
4 79.5
Code Amount Ratio Converted Amount
1
4
2000.00
79.50
0.31
4.55
609.60
361.41

You have to perform error checking for the following scenarios. In case of errors,
your program should print an error message.

Error Type Example Input / Output
Invalid
conversion
type
The user enters an
unknown conversion
type.
1
10 3000
Invalid code. Please reenter.
Invalid number
of conversion
requests
The user enters a
negative number for
the number of
conversion requests.
0
Please enter a positive number! -2
Please enter a positive number!

有没有人帮帮我写出来啊?
搜索更多相关主题的帖子: 英文 
2009-10-12 12:59
m456m654
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:3
帖 子:783
专家分:2806
注 册:2009-9-17
收藏
得分:3 
自己好好翻译一下就明白了,题目不是特别难,不会难为你的。
2009-10-12 18:36
HenryJay
Rank: 1
等 级:新手上路
帖 子:17
专家分:6
注 册:2009-10-2
收藏
得分:3 
主要叫你convert(转换)

像马力到瓦特

加仑到公升
磅到公斤等


后面是一些提示!
2009-10-12 19:13
快速回复:英文编程 不知它想干嘛
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024241 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved