首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
代做program、代写Java语言程序
项目预算:
开发周期:
发布时间:
要求地区:
Homework2
Note: Submit your work (upload the .java source code files ONLY, not the compiled .class files!) through the “Homework2” link on Brightspace. You may submit an unlimited number of times; we will only grade the last/latest submission attempt, but be sure to attach all of your files to each submission attempt. Be sure to include your name and Stony Brook ID number in a comment at the beginning of each file that you submit.
Due: Thursday, October 10, 11:59pm Total: 25 points (5 points per problem)
Submission Instructions: Name your java classes for this assignment as:
Problem1: Pyramid.java
Problem2: Interests.java
Problem3: LongestCommonPrefix.java Problem4: PerfectNumber.java Problem5: ArmstrongNumbers.java
1. Pyramid.java: (Printing numbers in a pyramid pattern) Write down a program in Java with a nested for loop that prints the following output (powers of 2) for any number of lines:
Here is a sample run:
Enter the number of lines: 8 Output:
1
121 12421 1248421
1 2 4 8 16 8 4 2 1
1 2 4 8 16 32 16 8 4 2 1
12 4 816326432168 4 2 1 124 81632641286432168 4 2 1
2. Interests.java: (Financial application: comparing loans with various interest rates) Write a program that lets the user enter the double loan amount and loan period in number of years (int) and displays the monthly and total payments for each interest rate starting from 5% to 8%, with an increment of 1/8.
Here is the sample run:
Loan amount: 10000.00
Number of years: 5
Interest Rate Monthly Payment 5.000% 188.71
Total Payment
11322.74
5.125% 189.28 5.250% 189.85 ...
7.875% 202.16 8.000% 202.76
11357.13 11391.59
12129.97 12165.83
𝑑𝑜𝑢𝑏𝑙𝑒 𝑚𝑜𝑛𝑡h𝑙𝑦𝐼𝑛𝑡𝑒𝑟𝑒𝑠𝑡𝑅𝑎𝑡𝑒 = 𝑎𝑛𝑛𝑢𝑎𝑙𝐼𝑛𝑡𝑒𝑟𝑒𝑠𝑡𝑅𝑎𝑡𝑒 / 1200 ;
𝑑𝑜𝑢𝑏𝑙𝑒 𝑚𝑜𝑛𝑡h𝑙𝑦𝑃𝑎𝑦𝑚𝑒𝑛𝑡 = 𝑙𝑜𝑎𝑛𝐴𝑚𝑜𝑢𝑛𝑡 ∗ 𝑚𝑜𝑛𝑡h𝑙𝑦𝐼𝑛𝑡𝑒𝑟𝑒𝑠𝑡𝑅𝑎𝑡𝑒 / (1 − (𝑀𝑎𝑡h.𝑝𝑜𝑤(1/(1 + 𝑚𝑜𝑛𝑡h𝑙𝑦𝐼𝑛𝑡𝑒𝑟𝑒𝑠𝑡𝑅𝑎𝑡𝑒),𝑛𝑢𝑚𝑏𝑒𝑟𝑂𝑓𝑌𝑒𝑎𝑟𝑠 ∗ 12))); 𝑑𝑜𝑢𝑏𝑙𝑒 𝑡𝑜𝑡𝑎𝑙𝑃𝑎𝑦𝑚𝑒𝑛𝑡 = 𝑚𝑜𝑛𝑡h𝑙𝑦𝑃𝑎𝑦𝑚𝑒𝑛𝑡 ∗ 𝑛𝑢𝑚𝑏𝑒𝑟𝑂𝑓𝑌𝑒𝑎𝑟𝑠 ∗ 12; 𝑆𝑦𝑠𝑡𝑒𝑚.𝑜𝑢𝑡.𝑝𝑟𝑖𝑛𝑡𝑓("%.3𝑓%% %.2𝑓 %.2𝑓\𝑛",𝑎𝑛𝑛𝑢𝑎𝑙𝐼𝑛𝑡𝑒𝑟𝑒𝑠𝑡𝑅𝑎𝑡𝑒, 𝑚𝑜𝑛𝑡h𝑙𝑦𝐼𝑛𝑡𝑒𝑟𝑒𝑠𝑡𝑅𝑎𝑡𝑒, 𝑡𝑜𝑡𝑎𝑙𝑃𝑎𝑦𝑚𝑒𝑛𝑡);
3. LongestCommonPrefix.java: Write a program in Java that prompts the user to enter two strings and display the largest common prefix of the two strings. If there are no common prefix between the two entered strings display a message which tells the user that the two string doesn’t have a common prefix.
Here are some sample run:
Enter the first string: Atlanta
Enter the second string: Macon
Atlanta and Macon have no common prefix.
Enter the first string: Welcome to Java
Enter the second string: Welcome to programming
The common prefix is: Welcome to
Note: The prefix actually includes the space after ‘to’ as well
Enter the first string: I love coffee Enter the second string: I love Java The common prefix is I love
4. PerfectNumber.java: A positive integer is called a perfect number if it is equal to the sum of all of its positive divisors, excluding itself. For example, 6 is the first perfect number because 6 = 3 + 2 + 1. The next is 28 = 14 + 7 + 4 + 2 +1. Write a program that asks the user for an upper limit and prints all the perfect numbers up to that limit.
Here is a sample run:
Enter the upper limit: 10000
The perfect numbers below 10000 are: 6 28 496 8128.
5. ArmstrongNumbers.java: An Armstrong number is an n-digit integer such that the sum of the 𝑛𝑡h power of its digits is equal to the number itself. For example, 371 is an Armstrong number because 33 + 73 + 13 = 371 (371 is a 3-digit number). 8208 is an Armstrong number because 84 + 24 + 04 + 84 = 8208 (8208 is a 4-digit number). Write a program that asks the user for a lower limit and an upper limit and prints all the Armstrong numbers up to that limit.
Here are some sample runs:
Enter the lower limit: 10
Enter the upper limit: 1000
The Armstrong numbers between 10 and 1000 are: 153 370 371 407
Enter the lower limit: 8000
Enter the upper limit: 20000
The Armstrong numbers between 8000 and 20000 are: 8208 9474
Enter the lower limit: 25000
Enter the upper limit: 100000
The Armstrong numbers between 25000 and 100000 are: 54748 92727 93084
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做ceng0013 design of a pro...
2024-11-13
代做mech4880 refrigeration a...
2024-11-13
代做mcd1350: media studies a...
2024-11-13
代写fint b338f (autumn 2024)...
2024-11-13
代做engd3000 design of tunab...
2024-11-13
代做n1611 financial economet...
2024-11-13
代做econ 2331: economic and ...
2024-11-13
代做cs770/870 assignment 8代...
2024-11-13
代写amath 481/581 autumn qua...
2024-11-13
代做ccc8013 the process of s...
2024-11-13
代写csit040 – modern comput...
2024-11-13
代写econ 2070: introduc2on t...
2024-11-13
代写cct260, project 2 person...
2024-11-13
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!