网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
09月04日漏签0天
编程吧 关注:372,812贴子:1,635,586
  • 看贴

  • 图片

  • 吧主推荐

  • 视频

  • 游戏

  • 7回复贴,共1页
<<返回编程吧
>0< 加载中...

有没有人会编程呀?帮帮我呀

  • 只看楼主
  • 收藏

  • 回复
  • 飘零梦0
  • 中级粉丝
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼


There are three questions in this assignment.  Each question is worth equal marks.

Question One

A Java program is to read the size of a square from the keyboard and then display an empty square grid in the following way. If the size of the square entered was 6, the display would appear as:

-------------
| | | | | | |
-------------
| | | | | | |
-------------
| | | | | | |
-------------
| | | | | | |
-------------
| | | | | | |
-------------
| | | | | | |
-------------

(a) Design an algorithm to solve the above problem, using pseudocode to record it. You will need to use nested loops to solve this problem.

(b) Convert your algorithm into a java program.

 
Question Two

You are required to design and code a class Loan for managing a bank loan throughout its repayment period. 

A Loan object will hold information regarding:

- The outstanding balance of the loan
- The annual interest rate
- The fixed monthly repayment
- The current duration of the loan in years and months.

The class should include a constructor, which will receive a loan amount, annual interest rate as a percentage and monthly repayment as parameters and will initialise the duration of the loan to zero. 

Additional functions will be:

(i) A function to process the next payment. This function should update the month and year, calculate the current month’s interest, add the interest and subtract the monthly payment to obtain a revised balance. It should then return as a formatted String the details of the month’s transaction, specifically

- Year Number
- Month number
- Initial balance
- Interest for the month
- Repayment
- Closing balance

The function must check for the final payment, and if the initial balance plus interest is less than the standard repayment, the repayment must be adjusted so as to bring the closing balance to exactly zero.

(ii) A function to change the interest rate.


(iii) A function to change the monthly repayment

Interest for the month is calculated by:

Interest = Initial balance * Annual Interest Rate / 1200.00

You are also required to write a driver class TestLoan, to test the correct working of your Loan class. 

This class should 

1. create a Loan object, with

Loan amount = $30,000
Annual interest rate = 7.5%
Monthly Repayment $800

2. Simulate 10 months of repayments, by displaying the String returned from 10 successive calls to the next payment method.

3. Reset the monthly repayment to $600

4. Simulate a further 10 months of repayments

5. Reset the annual interest rate to 5%.

6. Simulate a further 10 months of repayments.


Output from the program should look like this:

   0   1  $30,000.00   $187.50   $800.00  $29,387.50
   0   2  $29,387.50   $183.67   $800.00  $28,771.17
   0   3  $28,771.17   $179.82   $800.00  $28,150.99
   0   4  $28,150.99   $175.94   $800.00  $27,526.94
   0   5  $27,526.94   $172.04   $800.00  $26,898.98
   0   6  $26,898.98   $168.12   $800.00  $26,267.10
   0   7  $26,267.10   $164.17   $800.00  $25,631.27



  • 飘零梦0
  • 中级粉丝
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
   0   8  $25,631.27   $160.20   $800.00  $24,991.46
   0   9  $24,991.46   $156.20   $800.00  $24,347.66
   0  10  $24,347.66   $152.17   $800.00  $23,699.83
Repayment changed to $600.00
   0  11  $23,699.83   $148.12   $600.00  $23,247.96
   1   0  $23,247.96   $145.30   $600.00  $22,793.26
   1   1  $22,793.26   $142.46   $600.00  $22,335.71
   1   2  $22,335.71   $139.60   $600.00  $21,875.31
   1   3  $21,875.31   $136.72   $600.00  $21,412.03
   1   4  $21,412.03   $133.83   $600.00  $20,945.86
   1   5  $20,945.86   $130.91   $600.00  $20,476.77
   1   6  $20,476.77   $127.98   $600.00  $20,004.75
   1   7  $20,004.75   $125.03   $600.00  $19,529.78
   1   8  $19,529.78   $122.06   $600.00  $19,051.84
Interest Rate changed to 5%
   1   9  $19,051.84    $79.38   $600.00  $18,531.22
   1  10  $18,531.22    $77.21   $600.00  $18,008.44
   1  11  $18,008.44    $75.04   $600.00  $17,483.47
   2   0  $17,483.47    $72.85   $600.00  $16,956.32
   2   1  $16,956.32    $70.65   $600.00  $16,426.97
   2   2  $16,426.97    $68.45   $600.00  $15,895.42
   2   3  $15,895.42    $66.23   $600.00  $15,361.65
   2   4  $15,361.65    $64.01   $600.00  $14,825.65
   2   5  $14,825.65    $61.77   $600.00  $14,287.43
   2   6  $14,287.43    $59.53   $600.00  $13,746.96

You are provided with a file,  Pad.java, which contains methods that can be used for formatting your output.  You will find Pad.java on the W:/ drive.

Requirements

(a) Prepare object tables for the Loan and TestLoan classes, with columns indicating attributes and methods.

(b) Write complete java code for both the Loan and TestLoan classes.
 
Question Three

The mode of a list of numbers is the number listed most often.  Write a program that takes 10 numbers as input and displays the mode of these numbers.  Your program should use parallel arrays and a method that takes an array of numbers as a parameter and returns the maximum value in the array.

会就加我QQ:79328921,谢谢啦,



2025-09-04 14:48:35
广告
不感兴趣
开通SVIP免广告
  • 飘零梦0
  • 中级粉丝
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
用JAVA编,


  • 219.159.69.*
快试试吧,
可以对自己使用挽尊卡咯~
◆
◆
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
太烦琐 懒得


  • N2O
  • 初级粉丝
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
做是可以,但是没有这个激情啊


  • 221.194.132.*
快试试吧,
可以对自己使用挽尊卡咯~
◆
◆
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
英语不好吧,那没有办法了


  • 222.209.51.*
快试试吧,
可以对自己使用挽尊卡咯~
◆
◆
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
做是可以,但是没有这个激情啊


  • 飘零梦0
  • 中级粉丝
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
5楼大哥帮帮我好吗?
这可关系到我的大事呀,你就做做好人吧


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 7回复贴,共1页
<<返回编程吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示