联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codehelp

您当前位置:首页 >> Java程序Java程序

日期:2021-04-27 08:13

Lab 07 – Arrays.

Reminder if VS gives you a warning about scanf you can disable this by doing the following :

In your project go to the file menu project -> properties.
In the window go to the C/C++ , preprocessor then in the Preprocessor definitions enter the line :

_CRT_SECURE_NO_WARNINGS

Exercise 1.
Write a program that asks the user to enter 15 integers. Once the user has entered the integer the , program should output the following :
i)The sum of all the integers.
ii)The average of the integers.
iii)The list of integers in reverse order.

Exercise 2.
Write a program that asks the user to input a word. The program should then check whether the user has entered a palindrome(*).
(*) Palindromes are words or phrases that are spelt the same backwards as they are forward Eg. rotor, radar and level are all palindromic words.

Exercise 3.
Write a program that asks the user to enter two words. The program should then check if one word is an anagram(*) of the other.

(*) Anagrams are words that contain exactly the same letters as another word but in a different order Eg. carthorse is an anagram of orchestra.

Exercise 4.
a)Consider the table below :

Robot Number Speed Weight Max. Run-Time Price
1 4.5 5.6 12.7 495.99
2 5.6 8.9 8.2 599.95
3 2.1 14.6 6.5 399.95
4 7.9 6.4 3.4 749.65

The table gives information about 4 mobile robots :
Top Speed (m/s), Weight (Kg), Maximum Run-Time on a full battery (Hours), Price (£).
Write a program that stores the information in a single array, and allows the user to change any value (including robot name). The program should also allow the user to select the following information when requested via a simple menu:
i)The fastest / slowest robots.
ii)The heaviest / lightest robots.
iii)The robots with the best / worst maximum run-time.
iv)The cheapest / most expensive robots.
v)The average speed of all the robots.
vi)The average Weight of all the robots.
vii)The average runtime of all the robots.
viii)The average price of all the robots.
ix)All the details of any one robot.

版权所有:留学生编程辅导网 2021,All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。