You have been asked to code a solution for the following problem: 1. Read a file that contains the weights of people in pounds. You need to convert the weight from pounds to kilogram and store it in array, then sort the array using a sorting algorithm. Your program should behave like this. [2:48 PM] Input: Text that contains weights of people in pounds. The file: weights.txt Output: depending on the choice of the user • List the content of the file • Sort the content of the file • Search for a number in the file Steps 1. Read the file, convert pounds to kilograms (kilograms = pounds * 0.45359237) and store in an array 2. Display the following menu P. print the file D. display sorted list S. search Q. Quit Take a choice 3. while( the choice is not Q) If choice is P then print the array If choice is D then Sort the array and print the content If choice is S then ask for name and search the array. Display found or not If choice is Q quit the program Take choice
You have been asked to code a solution for the following problem:
1. Read a file that contains the weights of people in pounds. You need to convert the weight from pounds to kilogram and store it in array, then sort the array using a sorting
[2:48 PM]
Input: Text that contains weights of people in pounds.
The file: weights.txt
Output: depending on the choice of the user
• List the content of the file
• Sort the content of the file
• Search for a number in the file
Steps
1. Read the file, convert pounds to kilograms (kilograms = pounds * 0.45359237) and store in an array
2. Display the following menu
P. print the file
D. display sorted list
S. search
Q. Quit
Take a choice
3. while( the choice is not Q)
If choice is P then print the array
If choice is D then Sort the array and print the content
If choice is S then ask for name and search the array. Display found or not
If choice is Q quit the program
Take choice
The file: weights.txt | 23.1332 196.211 121.254 132.277 209.439 182.984 |
Step by step
Solved in 4 steps with 9 images