Question

In: Computer Science

Unit 09 Drop Box Assignment ONLY ONE FILE may be turned in for the assignment. If...

Unit 09 Drop Box Assignment
ONLY ONE FILE may be turned in for the assignment. If you make a mistake and need to turn
in your work again, you may do so. I will only grade the latest file you turn in. The older ones
will be ignored. For instruction on How To do assignments and create the file see the "How To
Do Homework" document under the "Start Here" button.
The Assignment
Create a Visual Logic flow chart with four methods. Main method will create an array of 5
elements, then it will call a read method, a sort method and a print method passing the array
to each. The read method will prompt the user to enter 5 numbers that will be stored in the
array. The sort method will sort the array in ascending order (smallest to largest). The print
method will print out the array.
A sample run might look like this:
Please enter a number: 2
Please enter a number: 7
Please enter a number: 1
Please enter a number: 10
Please enter a number: 3
Your numbers are: 1, 2, 3, 7, 10

Solutions

Expert Solution

Visual Logic Flow Chart for the above four methods :-

Explanation :-

An array[5 ] is declared in main method of int type . In the main method the method read method is declared and defined and also called to take array elements as the input from the user . Using this array the sort method is called and the array elements are sorted in ascending order . This sorted array is used to call the print method that prints the sorted array on the output console .

The working code for the above question in language C is :-

#include <stdio.h>

int main()
{
int array[5];


void read()
{

for(int i = 0 ; i < 5 ; i++)
{
printf("Please enter a number : ");
scanf("%d",&array[i]);
}
}
read();


void sort()
{

for(int j = 0 ; j < 5 ; j++)
{
for(int k = j+1 ; k < 5 ; k++)
{
  
if(array[j] > array[k])
{
int t = array[j];
array[j] = array[k];
array[k] = t;
}
}
}
}
sort();


void print()
{
printf("The sorted array is : ");
for(int l = 0 ; l < 5 ; l++)
{
printf("%d " , array[l]);
}
}
print();


return 0;
}

Screenshot of the result :-


Related Solutions

describe feathure,benefits,costs,and file size limit for Drop box cloud
describe feathure,benefits,costs,and file size limit for Drop box cloud
Complete and submit the assignment in an EXCEL file. Full credit is earned only if the...
Complete and submit the assignment in an EXCEL file. Full credit is earned only if the formulas for the calculations is evident in the spreadsheet She Shed. Corp was organized in 2017. These business events occurred during the year, affecting intangible assets. 1.    Purchased a license for $20,000 on July 1, 2017. The license gives She Shed exclusive rights to sell its sheds in the tri-state region and will expire on July 1, 2025. 2.    Purchased a patent on January...
For this assignment, you will use the provided database in the Unit 5 script file. You...
For this assignment, you will use the provided database in the Unit 5 script file. You will add statements to this file to query the database tables. For your reference, below is a screenshot of the enhanced entity relationship diagram (ERD) as a reference when you write your queries. With the data types listed in the diagram, this will help you identify the types of operators that you can use for particular queries. Use paiza.io for MySQL to execute and...
2. There may be only one or there may be more than one correct response to...
2. There may be only one or there may be more than one correct response to this question. You need only mark any one of the possible correct responses to be marked correct. A - Touch the top of the electroscope with your finger B - Remove your finger from the top of the electroscope C - Touch the top of the electroscope with a glass rod that was just previously rubbed by silk D - Touch the top of...
JAVA Assignment: Project File Processing. Write a program that will read in from input file one...
JAVA Assignment: Project File Processing. Write a program that will read in from input file one line at a time until end of file and output the number of words in the line and the number of occurrences of each letter. Define a word to be any string of letters that is delimited at each end by either whitespace, a period, a comma or the beginning or end of the line. You can assume that the input consists entirely of...
Java Programming For this assignment, you should modify only the User.java file. Make sure that the...
Java Programming For this assignment, you should modify only the User.java file. Make sure that the InsufficientFundsException.java file is in the same folder as your User.java File. To test this program you will need to create your own "main" function which can import the User, create an instance and call its methods. One of the methods will throw an exception in a particular circumstance. This is a good reference for how throwing exceptions works in java. I would encourage you...
Create and display an XML file in Android studio that has -One edittext box the does...
Create and display an XML file in Android studio that has -One edittext box the does NOT use material design -One edittext box that DOES use material design Provide a “hint” for each, and make sure the string that comprises the hint is referenced from the strings.xml file. Observe the differences in how the hints are displayed. Here is sample code for a material design editText: <android.support.design.widget.TextInputLayout         android:id="@+id/input_layout_price1Text"         android:layout_width="80dp"         android:layout_height="40dp"            >     <EditText             android:id="@+id/price1Text"             android:importantForAutofill="no"...
Answer the following problems in an Excel file. Please upload only one Excel file with all...
Answer the following problems in an Excel file. Please upload only one Excel file with all of your answers, including #3 (which requires an explanation rather than a calculation). All problems must be solved using the PV and FV functions in Excel. If I deposit $8,000 in a bank account that pays interest of 1.5%, compounded annually, how much will I have in the account after 10 years? If I deposit $8,000 in a bank account that pays simple interest...
(python only) Assignment: Guess a number To get started, open IDLE and create a New File...
(python only) Assignment: Guess a number To get started, open IDLE and create a New File via the File menu. We suggest you immediately save this file in the directory managing all your 102 Python Labs this semester. Please save this file with the following name: Week9A-guess_number.py. In this lab, use while loops to create a game where the user of your program guesses a number between 1 and 100. The user keeps guessing until they get it right. You...
Please use ONLY one Excel file to complete case study one, and use one spreadsheet for...
Please use ONLY one Excel file to complete case study one, and use one spreadsheet for each problem. Finally, upload the Excel file to the submission link (Week 3 Case Study) for grading. No credit will be granted for problems that are not completed using Excel. In 2011, when the Gallup organization polled investors, 26% rated gold the best long-term investment. But in April of 2013 Gallup surveyed a random sample of U.S. adults. Respondents were asked to select the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT