1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
goldenfox [79]
3 years ago
13

Lab Assignment 7A For the lab this week, you will sort an array - using any of the sort methods discussed in Chapter 23 or the S

election sort. It's your choice. Use the following criteria for your assignment: Write a program that uses a two-dimensional array to store daily minutes walked and carb intake for a week. Prompt the user for 7 days of minutes walked and carb intake; store in the array. Write a sort ( your choice which sort ) to report out the sorted minute values -lowest to highest. Write another to report out the sorted carb intake - highest to lowest. These methods MUST be your original code. Your program should output all the values in the array and then output the 2 sorted outputs. You must use an array to receive credit for this assignment.
Computers and Technology
1 answer:
Sliva [168]3 years ago
5 0

Answer:

See explaination

Explanation:

import java.util.Scanner;

public class sort {

static void lowestToHighest(float arr[][])

{

float temp;

for(int i=0;i<11;i++)

for(int j=0;j<12-i-1;j++) //Using bubble sort to sort

{

if(arr[j][0]>arr[j+1][0])

{

temp = arr[j][0];

arr[j][0] = arr[j+1][0];

arr[j+1][0] = temp;

}

}

for(int i=0;i<11;i++) //Using bubble sort to sort

{

for(int j=0;j<12-i-1;j++)

if(arr[j][1]>arr[j+1][1])

{

temp = arr[j][1];

arr[j][1] = arr[j+1][1];

arr[j+1][1] = temp;

}

}

System.out.println("Data in the array after sorting lowest to highest: ");

for(int i=0;i<12;i++)

System.out.printf(arr[i][0]+" "+arr[i][1]+"\n");

}

static void highestToLowest(float arr[][])

{

float temp;

for(int i=0;i<11;i++)

for(int j=0;j<12-i-1;j++) //Using bubble sort to sort

{

if(arr[j][0]<arr[j+1][0])

{

temp = arr[j][0];

arr[j][0] = arr[j+1][0];

arr[j+1][0] = temp;

}

}

for(int i=0;i<11;i++) //Using bubble sort to sort

{

for(int j=0;j<12-i-1;j++)

if(arr[j][1]<arr[j+1][1])

{

temp = arr[j][1];

arr[j][1] = arr[j+1][1];

arr[j+1][1] = temp;

}

}

System.out.println("Data in the array after sorting highest to lowest: ");

for(int i=0;i<12;i++)

System.out.printf(arr[i][0]+" "+arr[i][1]+"\n");

}

public static void main(String[] args){

float temperature[][]=new float[12][2];

Scanner input = new Scanner(System.in);

System.out.println("Enter 12 months of highest and lowest temperatures for each month of the year: ");

for(int i=0;i<12;i++)

for(int j=0;j<2;j++)

temperature[i][j]=input.nextFloat();

System.out.println("Data in the array: ");

for(int i=0;i<12;i++)

System.out.printf(temperature[i][0]+" "+temperature[i][1]+"\n");

lowestToHighest(temperature);

highestToLowest(temperature);

}

}

You might be interested in
The relational algebra expressions can be rearranged and achieve the same result but with a better processing time. A selection
BigorU [14]

Answer:

c. This would reduce the number of tuples to involve in the join resulting in a more efficient query.

Explanation:

SQL or structured query language is a database querying language used to communicate or interact with databases. A database query could be as simple as returning all the columns from a database table to complex like joining several query results which in turn forms an algebra expression.

Every query statement or expression is executed with time, execution time needs to be minimized for efficiency, so, a well-arranged and reduced joining in the query improves the efficiency of the query.

8 0
3 years ago
1. Consider the numbers 23.724 and 0.3344770219. Please normalize both. 2. Calculate their sum by hand. 3. Convert to binary ass
elena-s [515]

Answer:

please see explaination and attachment

Explanation:

Normalization is a database design technique that organizes tables in a manner that reduces redundancy and dependency of data. Normalization divides larger tables into smaller tables and links them using relationships.

see attachment for the step by step solution

7 0
3 years ago
Define algorithm<br> Write a small algorithm
Nataly [62]

Answer:

an algorithm (pronounced AL-go-rith-um) is a procedure or formula for solving a problem, based on conducting a sequence of specified actions. A computer program can be viewed as an elaborate algorithm. In mathematics and computer science, an algorithm usually means a small procedure that solves a recurrent problem.

3 0
3 years ago
Read 2 more answers
A career in information technology that involves using or managing computer systems
g100num [7]

A career in information technology that involves using or managing computer systems is option b: Network architect.

<h3>What is the field of information technology?</h3>

The field of information technology is known to be called IT and this is one that covers the aid, administration, as well as the design of telecommunications and that of the computer systems.

Note that the positions in this field is made up of system analysts, software programmers, and others.

Hence, A career in information technology that involves using or managing computer systems is option b: Network architect.

Learn more about information technology from

brainly.com/question/14314381

#SPJ1

5 0
2 years ago
The strPhone variable should contain only numbers and no dashes (-). An error message should display if there is a dash anywhere
Phantasy [73]

Answer:

Following are the code in the Java Programming Language.

if strPhone.Contains("-") = True then

Explanation:

In the following code, we check the condition through the if conditional statement is that if the variable "strPhone" contain dashes(-) by using the "Contains()" function is equal to True then it display the message and the variable "strPhone" contains the phone numbers. So, that's why the following If statement is correct.

6 0
4 years ago
Other questions:
  • Which of the following is not a feature of Hootsuite?
    14·1 answer
  • What is out put.what is data. what is microprocessor
    14·1 answer
  • When all RGB colors have the same value, the resulting color will most likely be some variation of _______________.
    11·1 answer
  • Which of the following is the most significant outcome of the formation of the SMPTE?
    6·2 answers
  • The keys in the computer's keyboard are represented by a numeric code agreement (ASCII). For example A is 65 and a is 97.
    12·1 answer
  • What was the first e-commerce service?
    10·1 answer
  • Code written by computer programmers is translated to binary code, so computers can understand the instructions. True or False
    7·1 answer
  • Which of the following is a definition of a conventions
    8·2 answers
  • After reading through the code, what will happen when you click run?​
    13·1 answer
  • List out any four hardware and software components required for multimedia​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!