Unit 8
[IT213: Software Development Concepts]
Unit 8 Assignment Instructions
In this unit you will complete the coding exercises before starting the Coding Project. Review the detailed
instructions and rubrics before starting your Assignments.
Submission Instructions
You will submit the following:
.cs files for C#
.java files for Java
.php and/or .js files for Web Development
Additionally, in a Word document, paste a screenshot of the output for each exercise.
You will be submitting three code files, one for each exercise (.cs, .java, .php or .js) and one Word
document in a zipped folder.
Zip these four files into a zipped folder and submit the one zipped folder.
Naming Your Files and Zip Folder
The code files should be saved as: IT213_YourLastName_UnitX_ExerciseX_Language.
The word document should be saved as: IT213_YourLastName_UnitX_Screenshots
The zip folder should be saved as: IT213_YourLastName_UnitX_ZIP
Unit 8 Assignment: Coding Exercises
8-1. For the language of your choice, type in the following accurate code, and then run this code.
Unit 8 Assignment: Coding Exercises
8-1. For the language of your choice, type in the following accurate code, and then run this code.
Java
// Initializing the elements of an array to default values of zero.
public class InitArray
{
public static void main( String[] args )
Unit 8
[IT213: Software Development Concepts]
{
int[] array; // declare array named array
int counter;
array = new int[ 10 ]; // create the array object
System.out.printf( "%s%8s\n", "Index", "Value" ); // column headings
// output each array element's value
for ( int i = 0; i < array.length; i++ )
{array[i] = i;
System.out.printf("%s%8s\n",i, array[i] );
}
} // end main
} // end class InitArray
C#
using System;
namespace ConsoleApplication10
{
// Creating an array. using System;
public class InitArray
{
public static void Main(string[] args)
{
int[] array; // declare array named array
Unit 8
[IT213: Software Development Concepts]
array = new int[10]; // create the space for array and initialize to default zeros
Console.WriteLine("{0}{1,8}", "Index", "Value"); // headings
// output each array element's value
for (int counter = 0; counter < array.Length; ++counter)
{
array[counter] = counter;
Console.WriteLine("{0,2}{1,8}", counter, array[counter]);
}
Console.ReadKey();
} // end Main
} // end class InitArray
}
JavaScript
Array Program
Initialize an Array
Unit 8 [IT213: Software Development Concepts]
Initialize an Array
// Create an array, initialize the elements and display them
function myFunction()
{
var n1 = new Array( 10 ); // allocate five-element array
// assign values to each element of array n1
var length = n1.length; // get array's length once before the loop
for ( var i = 0; i < length; ++i )
{
n1[ i ] = i;
Unit 8
[IT213: Software Development Concepts]
document.writeln("Array index " + i + " is equal to " + i + "");
} // end for
document.writeln(" Array is now populated and initialized ");
} // end function
8-2. Write a program named studentAverage that prompts user for the number of students in a class. Store that
number in an integer variable called numStudents. Prompt the user to enter the final exam grade as an integer
value between 1 and 100 for each student and save those grade values in an integer array called grades. Iterate
through the array and display each student’s final exam grade, and then display the class average.
Expected Output if 3 students entered with following grades: 89, 95, 70
89
95
70
Class Average = 84.67
8-3. Create an array called numbers to hold the following values in this order: 25, 5, 48, 34, 1, 15. Write a
program to get the average of the six numbers.
Expected Output
Average = 21.33
Unit 8 Assignment: Coding Exercises Rubric
Exercise Criteria
Possible
Exercise 1 completed correctly
0-5
Earned
Unit 8
[IT213: Software Development Concepts]
Exercise 2 completed correctly
0-5
Exercise 3 completed correctly
0-5
Total
0-15
Unit 8 Assignment 2: Coding Project
Create and populate a string array called familyNames that holds five family names. You will ask the user to enter five
family names through console input (C#), using the Scanner (JAVA), or Forms (Web Development). You will then display
the family names by reading the contents of the array and display the content in the following format:
EXPECTED OUTPUT
You entered the following family names:
Name1
Name2
Name3
Name4
Name5
Unit 8 Assignment 2: Coding Project Rubric
Criteria
Points
Possible
Program gets user input for five family names using the correct technique according to
the instructions for each language.
0-5
Student correctly implements an array called familyNames.
The array is initialized to hold five elements.
0-5
0-5
Program stores user input for family names in the familyNames array.
0-5
Student correctly traverses the array to read the names in the array and prints those
names to the screen.
0-5
Program produces correct output.
0-5
Total
0-30
Unit 8 Assignment 3: Coding Project
Points
Earned
Unit 8
[IT213: Software Development Concepts]
You will use the celsius() and fahrenheit() functions from a previous assessment. The instructions for
these functions were as follows:
Write two functions. The first is called celsius() and has one integer argument called myTemp. The
function returns the Celsius equivalent of a Fahrenheit temperature using the calculation:
celsius = 5.0 / 9.0 * (fahrenheit – 32);
The second is called fahrenheit() and it has one int argument called myTemp. The function returns
the Fahrenheit equivalent of a Celsius temperature using the calculation:
fahrenheit = 9.0 / 5.0 * celsius + 32;
For this Project, you will create a function called getTemperatures(). The getTemperatures() function
will have one parameter called temperatures[].Within the getTemperatures() function you will populate
the temperatures array with the following values: 10,15,20,25,30,32,40,45,50,55,60,65,70. Your main
program will traverse through the array and display the Fahrenheit and Celsius equivalents.
EXPECTED OUTPUT
10 degrees Fahrenheit is -12 degrees Celsius
10 degrees Celsius is 50 degrees Fahrenheit
15 degrees Fahrenheit is -9 degrees Celsius
15 degrees Celsius is 59 degrees Fahrenheit
20 degrees Fahrenheit is -6 degrees Celsius
20 degrees Celsius is 68 degrees Fahrenheit
25 degrees Fahrenheit is -3 degrees Celsius
25 degrees Celsius is 77 degrees Fahrenheit
30 degrees Fahrenheit is -1 degrees Celsius
30 degrees Celsius is 86 degrees Fahrenheit
35 degrees Fahrenheit is 1 degrees Celsius
35 degrees Celsius is 95 degrees Fahrenheit
40 degrees Fahrenheit is 4 degrees Celsius
40 degrees Celsius is 104 degrees Fahrenheit
45 degrees Fahrenheit is 7 degrees Celsius
45 degrees Celsius is 113 degrees Fahrenheit
Unit 8
[IT213: Software Development Concepts]
50 degrees Fahrenheit is 10 degrees Celsius
50 degrees Celsius is 122 degrees Fahrenheit
55 degrees Fahrenheit is 12 degrees Celsius
55 degrees Celsius is 131 degrees Fahrenheit
60 degrees Fahrenheit is 15 degrees Celsius
60 degrees Celsius is 140 degrees Fahrenheit
65 degrees Fahrenheit is 18 degrees Celsius
65 degrees Celsius is 149 degrees Fahrenheit
70 degrees Fahrenheit is 21 degrees Celsius
70 degrees Celsius is 158 degrees Fahrenheit
Unit 8 Assignment 3: Coding Project Rubric
Criteria
Points
Points
Possible Earned
Student appropriately implements the temperatures array inside the
getTemperatures() function.
0-5
Student uses the appropriate Celsius and Fahrenheit functions from previous
Assignment.
0-5
Student passes the appropriate argument to the getTemperatures() function.
0-5
Student uses correct input values based on Assignment instructions.
0-5
Student appropriately names the variables according to Assignment instructions.
0-5
Program produces correct output.
0-5
Total
0-30
Unit 8 Assignment 4: Coding Project
Airline Passengers
Using a while loop (use count as the counter variable) and two arrays (names and sections), prompt a
passenger for the section they want to be in either First Class or Economy and prompt them for their
Unit 8
[IT213: Software Development Concepts]
name. Store the sections and names in the arrays. The arrays should be able to contain three
elements. Using a for loop (index variable i) print out the passenger name and type of seat. The
output should look as follows:
EXPECTED OUTPUT
Passengers and Seat Type:
Passenger: John Doe is in First Class
Passenger: Jane Doe is in Economy Class
Passenger: Susie Smith is in First Class
Unit 8 Assignment 4: Coding Project Rubric
Criteria
Points
Possible
Program appropriately uses a while loop to get input from user for desired
section and for their name.
0-5
Student correctly creates two arrays:
Student creates an array named sections.
0-3
Student creates an array named names.
0-3
Each array is initialized to contain three elements.
0-4
Program stores user input for sections and names in the appropriate
array.
0-5
Student correctly implements a for loop using index variable I to traverse
the arrays and print out passenger name and type of seat.
0-5
Program produces correct output.
0-5
Total
0-30
Points
Earned
Purchase answer to see full
attachment