Array

In: Computers and Technology

Submitted By caswell
Words 471
Pages 2
Associate Program Material

Simple Array Process

Input a list of employee names and salaries, and determine the mean (average) salary as well as the number of salaries above and below the mean.

Process Display Program Title Give instructions on the program Open file for interactive input (write) Prompt for Names and Salaries Check for negative numbers Check for sentinel value Loop until sentinel value is entered Get running total for Sum Get running total for Count Write input values to file Close file after input Determine if count is equal or greater than 1 Calculate average salary Display average salary Prompt for input Response Determine if user wants to continue Open file for batch processing (read) Loop for processing file Read salary field Gather running total for both count variables When the loop reaches EOF close file Display count variables as output Input Input Name (Name: String) Input Salary (Salary: Real) Output Display Average salary Display Count_2 above average salary Display Count_3 below average salary

Pseudocode
Main Module Declare Name, Response As String Declare Sum, Salaries, Average As Real Declare Count, Count_2, Count_3 As Integer Write “ Welcome to the Payroll Program ” Write “” Write “This programs intended use is for you to enter a list” Write “ of Names and Salaries into a…...

Similar Documents

Arrays

...button was assign to repaint() method. When we click the “Press here” button, It updates the window. There is also a counting that counts how many times we repaint the applet. Code: RoundRectDemo Explanation: As what we have seen, this illustrates how we draw a rectangle into circle. Its uses 6 parameters as the x and y location, the height and the width, and the point how it bends. In this output the increment of the points was 20, until the last number was 80 in which we draw a circle. TADAAA Code: SetFontDemo Explanation: This output is same as the Code DrawStingDemo.java but sets the font to Verdana, Bold, and size 26. Code: DrawPolyDemo Explanation: As what we seen above, we draw a Polygon that has 5 sides. We use an array that has 6 elements that assigns the point and location of our polygon. Following codes may explain: int xPoints[] = {5, 25, 50, 30, 15, 5}; int yPoints[] = {10, 35, 20, 65, 40, 10}; Code: RectangleDemo Explanation: The method used for this output was fillRect() and clearRect(). As what you have seen in the output. The fillRect() is the Rectangle inside the Rectangle and the clearRect() was the Rectangle outside the Rectangle inside the Rectangle or what we called the Rectangle. Code: SetColorDemo Explanation: This is same as the Code SetFontDemo.java but in this case, the Color of the font was changed to Blue but the I think I don’t know why the background that had been set yellow wouldn’t appear....

Words: 359 - Pages: 2

Array Structure

...Array Structure Joe Guckiean PRG/211 January 21, 2013 Vic Echeverria Array Structure The example used in the previous proposal did not contain an array structure. Therefore, a new example will be used for this paper. Arrays are an excellent way to gather and display data when the need for an external database is not required. An array essentially acts like a single variable that can store multiple chunks of data. Rather than acting like an individual box that can hold only one chunk of data, such as a single variable, an array acts like a big box divided into sections, where each section can store one chunk of data (Wang, 2011). There are two main types of arrays, single or multi-dimensional and parallel array. The most simple array involves a single data type. Names or items that are related to each other could be stored in a one dimensional array. A two dimensional array can have two types of data that are related to each other. An example would be a person’s name and age. Those two items are related to each other and would be represented in a table like structure. A parallel array consists of multiple arrays that act as a single array. For example, one array could contain names, a second could contain addresses, and a third could contain phone numbers. Each of the parallel arrays acts independently, but are related to each other. This proposal will be constructed using a parallel array displaying the population for the 88 counties in Ohio. Additional......

Words: 866 - Pages: 4

Arrays

...CHAPTER 5 – ARRAYS CASE STUDY SCENARIO Sorting Data A dozen umbrellas lie on the ground just inside the classroom door when Dr. Taylor begins his lecture. “A cold, rainy day like today makes me want to stay in and order pizza for delivery rather than go out myself.” Handing a phone book to a student in the front row, Dr. Taylor says “Gail, please look up the phone number for Domino’s Pizza on Main Street, and if you don’t mind, I will time how long it takes you to find the number.” Gail flips through a few pages while Dr. Taylor looks at his watch. “Here it is . . . 555-8275,” she says. “Seven seconds. Thank you Gail.” Dr. Taylor presses some keys on his cell phone while continuing his conversation. “Now please look up the name of the person with the phone number 555-5982, and again I will time you.” Dr. Taylor’s focus returns to his watch even as he speaks into the phone. Gail slowly flips a couple of pages, then stops just about the same time Dr. Taylor ends his call. “I assure you the number is in there, Gail. We will wait while you look it up.” “You will probably wait a long time,” she says, “because there is no fast way to find a number.” “Why not? It’s the same data.” “But the phone book is sorted by names, so finding a name is easy. Finding a number is very difficult because a phone book is not sorted by numbers.” Dr. Taylor takes the phone book from Gail. “Exactly! The sorting process does not change the data, but it organizes the data in a......

Words: 5653 - Pages: 23

Array

...and their state of residence. The program will display the average age of all family members input, and also display the names of any family members that live in Texas. We will create three separate arrays; one for the names of the family members, another for their ages, and the third will be for their state of residence. We'll first ask the user to enter the number of family members he has (we will limit this to a max of 25); this will allow us to determine how large of arrays we will need to create to store the data. We'll call this variable Size. After inputting all names, ages, and states of residence the data will all be stored within the arrays. The program will identify those family members who reside in Texas, and also display their names on the screen. This will be done by creating a loop that will review all the entries from the names and residencies arrays, compare the state to the string "Texas," and print that corresponding name. The average age will be calculated by also looping through the values in the age array, calculating the collective sum, then (as stated earlier) dividing by Size. Necessary Calculations The variable AvgAge (declared as Float) will be used in order to calculate the average age. A loop will go through each value of the Ages array, keep a running total sum, then divide that total by the variable Size to get the average age. //NOTE: I use Float instead of Integer because there is a possibility of losing a trailing decimal if......

Words: 617 - Pages: 3

Array

...Nouns | | Verbs | | | | | | Program | Hours | Design | | Arrays | Data | Uses | | People | | Hold | | Integers | | Worked | | Subscripts | | Relate | | Numbers | | Stored | | Pay | | Ask | | wages | | Entered | | hours | | display | | Word Analysis Variable Chart Input | Interim | Output | hours | [index] | wages | empId | | | payRate | | | | | | | | | | | | Major Task List 1. Input hours, employee id numbers, and payrates 2. Create arrays 3. Calculate wages to employee 4. Display results Structure Chart Main Main Psuedo Code PROGRAM Employees AUTHOR Stuart Marlar COURSE COP1000 FUNCTION main (void) RETURNING int BEGIN main Declare Integer Index Declare Integer Array empId[7] = (56588, 45201, 78951, 87775, 84512, 13028, 75804) Declare Double Array hours[7] = (0) Declare Double Array payRate[7] = (0) Declare Double Array wages[7] = (0) FOR index = 0 TO 7 - 1 STEP 1 DO OUTPUT "Employee ID" empId[index] REPEAT OUTPUT "Enter hours" INPUT hours[index] IF hours[index] OUTPUT"Hours cannot be negative" END-IF WHILE hour[index] < 0 ...

Words: 422 - Pages: 2

Tutorial on Pointers and Arrays in C

...A Tutorial on Pointers and Arrays in C A TUTORIAL ON POINTERS AND ARRAYS IN C by Ted Jensen Version 1.1 (HTML version) July 1998 This material is hereby placed in the public domain Available in various formats via http://www.netcom.com/~tjensen/ptr/cpoint.htm TABLE OF CONTENTS Preface Introduction Chapter 1: What is a Pointer? Chapter 2: Pointer Types and Arrays. Chapter 3: Pointers and Strings Chapter 4: More on Strings Chapter 5: Pointers and Structures Chapter 6: More on Strings and Arrays of Strings Chapter 7: More on Multi-Dimensional Arrays Chapter 8: Pointers to Arrays Chapter 9: Pointers and Dynamic Allocation of Memory Chapter 10: Pointers to Functions file:///E|/My%20eBooks/_ESSENTIALS_/A%20Tutorial%...orial%20on%20Pointers%20and%20Arrays%20in%20C.htm (1 of 2)3/18/2007 12:09:49 AM A Tutorial on Pointers and Arrays in C Epilog file:///E|/My%20eBooks/_ESSENTIALS_/A%20Tutorial%...orial%20on%20Pointers%20and%20Arrays%20in%20C.htm (2 of 2)3/18/2007 12:09:49 AM Preface PREFACE This document is intended to introduce pointers to beginning programmers in the C programming language. Over several years of reading and contributing to various conferences on C including those on the FidoNet and UseNet, I have noted a large number of newcomers to C appear to have a difficult time in grasping the fundamentals of pointers. I therefore undertook the task of trying to explain them in plain language with lots of examples. The first version of this document......

Words: 9878 - Pages: 40

Array List

...ArrayList The differences between the Array and an ArrayList is a common question asked by beginners, just starting to code using Java. The Array and ArrayList are both used to store elements, which can be a primitive or an object in the case of ArrayList in Java. A main difference between the ArrayList and an Array in Java would be the static nature of the Array, but the ArrayList has a dynamic nature. Once an Array is created, programmers cannot change the size of it, but an ArrayList will be able to re-size itself at any time. There is one more notable difference between ArrayList and an Array (Paul, 2012). The Array is a core part of Java programming that has a special syntax and a semantics support within Java. An ArrayList is a part of the collection framework of popular classes, such as HashMap, Hashtable, and Vector. There are six more differences between Array and ArrayList which will be listed in numeral order: 1. First and Major difference between Array and ArrayList in Java would be that Array is a fixed length data structure, while ArrayList is a variable length collection class. 2. Another difference is that an Array cannot use Generics, due to it cannot store files, unlike the ArrayList that allows users to use Generics to ensure storage. 3. Programmers can compare the Array vs. ArrayList on how to calculate length of Array or size of an ArrayList. 4. One more major difference within an ArrayList and Array is that programmers cannot......

Words: 395 - Pages: 2

Personal Learning Management Array Structure

...Personal Learning Management Array Structure Giovonnte J. Tate PRG/211 March 31, 2014 Travis Sprouse Object-Oriented Programming Parallel array structures can be used for many instances where the programer wants to input information that is different to them, such as keeping track of their important items of learning. The whole process of creating a program is of a structured nature. Code does not have to be difficult and can be written in simple English. What programmers need to do is input the data into the program and if it is functioning properly, a result based on that data and output will appear. All results come from a calculated list of items that have a represented value declared by the programmer. Arrays have been used in lots of problems to arrive at solutions for tasks and routines that people are involved in day to day. The For Loop and data sharing elements make the structure a desirable solution to any situation where programmers need to write codes and programs for a problems with many working parts, such as the me with several classes with a value rating applied. The data shared between the elements, assignments and projects completed, has to be shared in order to get your results. The most logical solution is the use of a parallel array structure. To test this conclusion, a pseudo code has been written and executed and is operating with satisfactory results. The pseudo code for this particular program is written as follows: Economic......

Words: 675 - Pages: 3

Sysotolic Array

...O . I , J A N U A R Y 1991 43 A Class of Least-Squares Filtering and Identification Algorithms with Systolic Array Architectures Seth Z. Kalson, Member, IEEE, and Kung Yao, Member, IEEE Abstract -A unified approach is presented for deriving a large class of new and previously known time and order recursive least-squares algorithms with systolic array architectures, suitable for high throughput rate and VLSl implementations of space-time filtering and system identification problems. The geometrical derivation given here is unique in that no assumption is made concerning the rank of the sample data correlation matrix. Our method utilizes and extends the concept of oblique projections, as used previously in the derivations of the leastsquares lattice algorithms. Both the growing and sliding memory, exponentially weighted least-squares criteria are considered. Index Terms-Least-squares systolic arrays. tions of the least-squares estimation problem: 1) the filtering problem is to find the filtered output y , , ( t ) , where n . Y,!(t)S Cgl'(t)xi(t), i=l 1ItIT; (1.2) 2) the identification problem is to find the filter weights g ; ( t ) , i = 1;. ., n, for any t I. T This generalization of the least-squares estimation problem is important whenever practical space-time or multichannel filtering arises, such as in adaptive antenna arrays, I. INTRODUCTION decision feedback and fractionally spaced channel equalizINIMUM mean-square estimation is an old......

Words: 8075 - Pages: 33

Array Structure

...ARRAY STRUCTURE PRG211 July 28, 2014 ARRAY STRUCTURE What is an Array? In this particular document, we will examine object oriented programming and the parameters of Creating an Array. What is an Array? An Array is a systematic arrangement of objects. In the field of Computer Science, they are different types of Arrays, but they all provide the same level of functionality. However, certain arrays provide an enhanced level of accommodation for the developer depending on the software language that the Coder is using. What is an object? The world around us consists of objects. These objects have a physical presence to them. Whether these objects are; people, furniture, cars or houses, they are all considered to be objects. In the business world, there are objects such as employers, employees, customers and etc. An object is a person place or thing. Therefore the name of an object is always a noun. The Definition of the Object The Behavior of the object helps us to give the object definition. In the programming world we refer to the definition in a certain way. The way that we refer to the object in this special way is called a “Class.” And inside of that class we have certain characteristics. The characteristics are called “data members” and also. The Class also has a certain behavior which we call “methods.” Defining Our Objects and Their Behavior In our Project for Programming, we have one class that we can define as it pertains to the......

Words: 511 - Pages: 3

C# Array

...Background Information: * Array is a list of data items that all have the same data type and the same name * Each item in the array is called an element . * Each element has an index. Beginning index is 0 Example 1: Suppose we would like to store the scores of 4 students in a classroom // create an array called scores whose size is 4 and stores numbers of type double double[ ] scores= new double[4]; //Assign values to the elements of the array . scores [0]=90; scores[1]= 95; scores [2]=70; scores[3]= 60; 90 | 95 | 70 | 60 | scores [0] scores [1] scores [2] scores [3] Example 2: You can also assign values to array elements using an Initializer list: // create an double array called scores and fill it with the 4 test scores 90, 95, 70, 60 double[ ] scores = {90, 95, 70, 60}; 90 | 95 | 70 | 60 | scores [0] scores [1] scores [2] scores [3] * Write code to display the value of the third element in a label: lblOutput.Text = scores[2].ToString(); * write a line of code to get the length of the array int size = scores.Length; // size is 4 Exercise 1 Code | | string[] letters = {“A”,”B”};int size = letters.Length; | What is the value of size ?What is stored in letters[1] ? | Exercise 2 Code | | int[] numbers = {10,20,30};int size = numbers.Length; | What is the value of size ?What is the value of : numbers[0] + numbers[1] + numbers[2]......

Words: 497 - Pages: 2

Video Graphics Array

...Definition of:VGA(1) (Video Graphics Array) For compatibility with earlier monitors and data projectors, laptop computers often include a VGA port, which was widely used on PCs (see definition #2 below). VGA on a Laptop A VGA socket (middle) is commonly found on Windows-based laptops and entry-level PCs. Macs use only DisplayPort (left) and Mini DisplayPort sockets (see DisplayPort). (2) (Video Graphics Array) An analog interface between a computer and monitor that was widely used prior to the DVI standard. Older CRTs used VGA, and flat LCD panels typically have both analog VGA and digital DVI. However, newer PCs may have only DVI or DisplayPort outputs. See flat panel display, DVI and DisplayPort. VGA Is Base Level VGA officially refers to only 640x480 pixels with 16 or 256 colors. This base resolution is used to boot the PC and also troubleshoot the computer in Safe Mode with the display driver disabled (in case the driver is the cause of the problem). VGA History VGA was introduced on IBM's PS/2 line in 1987 and quickly replaced the earlier digital CGA and EGA interfaces, which had lower resolution and fewer colors. In a short time, non-IBM vendors boosted resolution and colors, calling them "Super VGA." IBM later introduced XGA with a 1024x768 resolution, and over the years, numerous resolutions were added that were fractions or multiples of the total number of pixels in VGA and XGA resolutions. See screen resolution and XGA. The VGA Port (Socket) Using......

Words: 295 - Pages: 2

Java Array

...Java provides a data structure, the array, which stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type. Instead of declaring individual variables, such as number0, number1, ..., and number99, you declare one array variable such as numbers and use numbers[0], numbers[1], and ..., numbers[99] to represent individual variables. This tutorial introduces how to declare array variables, create arrays, and process arrays using indexed variables. Declaring Array Variables: To use an array in a program, you must declare a variable to reference the array, and you must specify the type of array the variable can reference. Here is the syntax for declaring an array variable: ------------------------------------------------- dataType[] arrayRefVar; // preferred way. ------------------------------------------------- ------------------------------------------------- or ------------------------------------------------- ------------------------------------------------- dataType arrayRefVar[]; // works but not preferred way. Note: The style dataType[] arrayRefVar is preferred. The style dataType arrayRefVar[] comes from the C/C++ language and was adopted in Java to accommodate C/C++ programmers. Example: The following code snippets are...

Words: 1665 - Pages: 7

Sd2720 Module 2 Using Operators, Arrays, and Constructs

...SD2720 Module 2 Using Operators, Arrays, and Constructs Click Link Below To Buy: http://hwcampus.com/shop/sd2720-module-2-using-operators-arrays-and-constructs/ SD2720 Module 2 Using Operators, Arrays, and Constructs Lab 2.2 Using Multidimensional Array and Loops In this lab, you will complete three tasks related to multidimensional arrays and loops. The tasks performed in this lab will help you understand how to program common array operations and simplify programming by using loops. Task 1 Write a Java program with the following functionalities: • It should use a one-dimensional array. • It should enable the user to search for an element in the array. • If the element is found, it should display the number of occurrences. • If the element is not found, an error message should be displayed. Task 2 Create a Java application that stores and maintains the employee details, including employee ID, employee name, department, designation, marital status, and date of marriage, in a multidimensional array. The application should have the following functionalities: • When the user selects the enter data option, the inputs should be accepted. • Date of marriage should be accepted only if the employee’ marital status is entered as “married.” • When the user selects the view data option, all the employee details should be displayed. • When the user selects the exit option, the application should terminate. For Task 3 • Did you write......

Words: 250 - Pages: 1

Arrays Versus Pointers

...Arrays versus Pointers A pointer is a variable which keeps a memory address. This address is the position of another item in memory. A pointer has variable name exactly like any other variable and also has got type which designates what type of variable its elements refer to. For instance, in case one variable has the memory address of another variable, the 1st variable is said to point to the second variable. Declaring a Pointer Pointers may be announced as we do normal variables, except for the pointer name has an asterisk before it to show that it's variable which is a pointer. The normal syntax for announcing a pointer is type* variable_name; We can put the asterisk near to variable name, but it’s a good programming routine to put the asterisk close type because it shows that the pointer variable points to that kind of variable. For instance, we wish to announce a pointer that keeps the memory address of an integer variable. The announcement would appear as follows int* ptr; There are 2 operators linked with pointers. 1. Address-of operator(&) This operator is utilized to get the address of a variable. It's a unary operator. Let's see an illustration on the way to utilize this operator. int var = 9; //declare a variable of integer type int* ptr; //declare pointer ptr = &var; //assign the address of var to pointer variable 2. Indirection operator(*) ...

Words: 288 - Pages: 2

Being Human (US) | “Reverse” | Riccardo Scamarcio