Facebook Sharer
选择您要替换的背景颜色:
【农历新年】背景图片:
个性化设定
 注册  找回密码
查看: 1750|回复: 6
打印 上一主题 下一主题

请帮忙我解决以下programming 的题目

[复制链接]

51

主题

0

好友

1336

积分

黄金长老

Rank: 8Rank: 8Rank: 8Rank: 8Rank: 8Rank: 8Rank: 8Rank: 8

跳转到指定楼层
1#
发表于 2009-7-17 11:22 AM |只看该作者 |倒序浏览
1.        Write a program that helps you balance your bank account. This interactive program should read a list of transaction amounts. (The first transaction amount should be the beginning balance). The program should then display the transactions, along with a running balance. At the end of the transactions, the program should display the total number of deposits (less 1), the total of all the deposits (other than the first one), the total number of withdrawals, and the total of all the withdrawals. Here’s an example of the program in use:


*** Bank Balance Helper ***

Enter beginning balance: 100
Transaction 1 (0 to end): 200
Transaction 2 (0 to end): -50
Transaction 3 (0 to end): 20.75
Transaction 4(0 to end): 0

*** Transaction Report ***

Beginning balance is 100
Transaction 1: Deposit 200, giving balance of 300
Transaction 2: Withdrawal of 50, giving balance of 250
Transaction 3: Deposit of 20.75, giving balance of 270.75

Number of deposits: 2
Total deposits: 220.75
Number of withdrawals: 1
Total withdrawals: 50
Current Balance: 270.75

Make the array hold exactly 10 floating-point numbers (This includes the beginning values). If the array fills, the program should automatically display the transaction report. If the balance goes below zero, display a warning message for that transaction, but allow the balance to be negative.



hint: Make an array size of 10 to store the every transaction data, use the do_while or other loop to ask users prompt the input. Then create three method
for deposit, withdrawal and also display report. The report will be display whenever user enter 0 or user has made 10 times transactions.




收藏收藏0

51

主题

0

好友

1336

积分

黄金长老

Rank: 8Rank: 8Rank: 8Rank: 8Rank: 8Rank: 8Rank: 8Rank: 8

2#
发表于 2009-7-17 11:24 AM |只看该作者
2.        Suppose the weekly hours for all employees are stored in a two-dimensional array. Each row records an employee’s seven-day work hours with seven columns. Write a program that displays employees and their total hours in decreasing order of the total hours.
       

        Sun        Mon        Tue        Wed        Thu        Fri        Sat
Emp0        2        4        3        4        5        8        8
Emp1        7        3        4        3        3        4        4
Emp2        3        3        4        3        3        2        2
Emp3        9        3        4        3        3        4        1
Emp4        3        5        4        6        6        3        8
Emp5        3        4        4        3        3        4        4
Emp6        3        7        4        3        3        8        4



hint: Solved using 2D array to count the sum, then keep the sum into the sum array. Then make one method named selectionSort to sort the sum array to
decreasing order, then to display the employee name together their working hour, you have to create one more array to store the employee's name.


回复

使用道具 举报

51

主题

0

好友

1336

积分

黄金长老

Rank: 8Rank: 8Rank: 8Rank: 8Rank: 8Rank: 8Rank: 8Rank: 8

3#
发表于 2009-7-17 11:49 AM |只看该作者
3.)  (finding the 2 highest score) write a program that prompt the users to enter the numbers of   students and each students's name and score.

3.1  display the student with highest score and the student with the second highest score.
3.2  then displays the number of students, and student's name and their scores. Their score      should be printed in "decreasing order".


回复

使用道具 举报

46

主题

6

好友

6456

积分

百变名嘴

Rank: 13Rank: 13Rank: 13Rank: 13

4#
发表于 2009-7-17 01:30 PM |只看该作者

回复 #1 lmy5360 的帖子

o。。。 2 dimentional array ~ 再见。


回复

使用道具 举报

7

主题

1

好友

5108

积分

一流名嘴

Rank: 12Rank: 12Rank: 12

5#
发表于 2009-7-17 01:38 PM |只看该作者
樓主應該搞錯討論區的意義, 這裡不幫忙做功課
自己應該嘗試做了之後把你的 coding 貼上, 其他人才會幫你指出你的錯誤或給你意見
況且這些都是很簡單的題目, 只要你平常有用心練習的話, 一天解決一題併不是難事


回复

使用道具 举报

1

主题

0

好友

35

积分

初级会员

Rank: 1

6#
发表于 2009-7-17 03:09 PM |只看该作者
哈哈最近的学生把这里当作是教科补习中心了


回复

使用道具 举报

46

主题

6

好友

6456

积分

百变名嘴

Rank: 13Rank: 13Rank: 13Rank: 13

7#
发表于 2009-7-17 04:05 PM |只看该作者

回复 #3 lmy5360 的帖子

是Java吗?
hint: Solved using 2D array to count the sum, then keep the sum into the sum array. Then make one method named selectionSort to sort the sum array to

decreasing order, then to display the employee name together their working hour, you have to create one more array to store the employee's name.

我建议你使用两种Array 不要2D的。

int[] _number;
String[] _string;

1. 别灰心这个已经是提示了。其实是很简单的东西  先给人家insert 东西 Input stream 还是什么 FOR LOOP 解决如果user 100 笔资料, 那么就当 n < input_total 就一直+++++ 下去咯。
 
for loop 要做的东西就是 一直让user 输入东西跟一直insert 资料进Array.
然后就通过 function 或 method 来计算 array 里的东西, return 回去, 再来就是 看题目吧==
说真的我英文不是很好, 不是很厉害这些英文字, 抱歉。


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

JBTALKS.CC |联系我们 |隐私政策 |Share

GMT+8, 2024-10-25 10:38 PM , Processed in 0.116417 second(s), 28 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

Ultra High-performance Dedicated Server powered by iCore Technology Sdn. Bhd.
Domain Registration | Web Hosting | Email Hosting | Forum Hosting | ECShop Hosting | Dedicated Server | Colocation Services
本论坛言论纯属发表者个人意见,与本论坛立场无关
Copyright © 2003-2012 JBTALKS.CC All Rights Reserved
合作联盟网站:
JBTALKS 马来西亚中文论坛 | JBTALKS我的空间 | ICORE TECHNOLOGY SDN. BHD.
回顶部