...javax.microedition.lcdui Class TextField java.lang.Object | +--javax.microedition.lcdui.Item | +--javax.microedition.lcdui.TextField public class TextField extends Item A TextField is an editable text component that may be placed into a Form. It can be given a piece of text that is used as the initial value. A TextField has a maximum size, which is the maximum number of characters that can be stored in the object at any time (its capacity). This limit is enforced when the TextField instance is constructed, when the user is editing text within the TextField, as well as when the application program calls methods on the TextField that modify its contents. The maximum size is the maximum stored capacity and is unrelated to the number of characters that may be displayed at any given time. The number of characters displayed and their arrangement into rows and columns are determined by the device. The implementation may place a boundary on the maximum size, and the maximum size actually assigned may be smaller than the application had requested. The value actually assigned will be reflected in the value returned by getMaxSize(). A defensively-written application should compare this value to the maximum size requested and be prepared to handle cases where they differ. Input Constraints The TextField shares the concept of input constraints with the TextBox object. The different constraints allow the application to request that the user's input be restricted in a variety of ways...
Words: 3677 - Pages: 15
...questions about VBA. † Finance Dept, Kellogg School, Northwestern University, 2001 Sheridan Rd., Evanston, IL 60208, tel: 847-491-8344, fax: 847-491-5719, E-mail: r-mcdonald@northwestern.edu. CONTENTS 2 5 Storing and Retrieving Variables in a Worksheet 5.1 Using a named range to read and write numbers from spreadsheet . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Reading and Writing to Cells Which are not Named. . . 5.3 Using the “Cells” Function to Read and Write to Cells. 10 the . . . . . . . . . 11 12 13 6 Using Excel Functions 13 6.1 Using VBA to compute the Black-Scholes formula . . . . . . 13 6.2 The Object Browser . . . . . . . . . . . . . . . . . . . . . . . 15 7 Checking for Conditions 16 8 Arrays 17 8.1 Defining Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . 18 9 Iterating 19 9.1 A simple for loop . . . . . . . . . . . . . . . . . . . . . . . . . 20 9.2 Creating a binomial tree . . . . . . . . . . . . . . . . . . . . . 20 9.3 Other...
Words: 10883 - Pages: 44
...Programming Logic and Design, 6th Edition Chapter 6 Exercises 1. a. Design the logic for a program that allows a user to enter 10 numbers, then displays them in the reverse order of their entry. Answer: A sample solution follows Flowchart: Pseudocode: start Declarations num index num SIZE = 10 num numbers[SIZE] = 0,0,0,0,0,0,0,0,0,0 getReady() while index < SIZE getNumbers() endwhile finishUp() stop getReady() index = 0 return getNumbers() output “Enter a number for position ”, index input numbers[index] index = index + 1 return finishUp() output “The numbers in reverse order are: ” while index > 0 index = index – 1 output numbers[index] endwhile return b. Modify the reverse-display program so that the user can enter up to 10 numbers until a sentinel value is entered. Answer: A sample solution follows Flowchart: Pseudocode: start Declarations num index num SIZE = 10 num numbers[SIZE] = 0,0,0,0,0,0,0,0,0,0 string CONTINUE = “Y” string moreNumbers = CONTINUE getReady() while index < SIZE AND moreNumbers equal to CONTINUE getNumbers() endwhile finishUp() stop getReady() index = 0 output “Do you want to enter a number? (Y/N)” input moreNumbers return getNumbers() output “Enter a number for position ”, index input numbers[index] index = index...
Words: 4366 - Pages: 18
...======================================== DeVry College of New York ECET 370 HW #1: Dynamic 2D-array ------------------------------------------------- Objective: Write a program to calculate students’ average test scores and their grades. You may assume the following file input data: Johnson 85 83 77 91 76 Aniston 80 90 95 93 48 Cooper 78 81 11 90 73 Gupta 92 83 30 69 87 Blair 23 45 96 38 59 Clark 60 85 45 39 67 Kennedy 77 31 52 74 83 Bronson 93 94 89 77 97 Sunny 79 85 28 93 82 Smith 85 72 49 75 63 Use three arrays: a one-dimensional array to store the students’ names, a (parallel) two-dimensional array to store the test scores, and a parallel one dimensional array to store grades. Your program must contain at least the following functions: a function to read and store data into two arrays, a function to calculate the average test score and grade, and a function to output the results. Have your program also output the class average. Tools required: PC & Visual studio software Code: #include <iostream> #include <fstream> #include <sstream> #include <string> using namespace std; bool readStudentData(ifstream &inFile, string &name, int &score1, int &score2, int &score3, int &score4, int &score5) { string line; if (getline(inFile, line)) { string word; istringstream iss(line, istringstream::in); int count = 0; try { while (iss >> word) { //cout...
Words: 673 - Pages: 3
...Lab 1: Introduction to MATLAB Warm-up MATLAB is a high-level programming language that has been used extensively to solve complex engineering problems. The language itself bears some similarities with ANSI C and FORTRAN. MATLAB works with three types of windows on your computer screen. These are the Command window, the Figure window and the Editor window. The Figure window only pops up whenever you plot something. The Editor window is used for writing and editing MATLAB programs (called M-files) and can be invoked in Windows from the pull-down menu after selecting File | New | M-file. In UNIX, the Editor window pops up when you type in the command window: edit filename (‘filename’ is the name of the file you want to create). The command window is the main window in which you communicate with the MATLAB interpreter. The MATLAB interpreter displays a command >> indicating that it is ready to accept commands from you. • View the MATLAB introduction by typing >> intro at the MATLAB prompt. This short introduction will demonstrate some basic MATLAB commands. • Explore MATLAB’s help capability by trying the following: >> help >> help plot >> help ops >> help arith • Type demo and explore some of the demos of MATLAB commands. • You can use the command window as a calculator, or you can use it to call other MATLAB programs (M-files). Say you want to evaluate the expression [pic], where a=1.2, b=2.3, c=4.5 and d=4....
Words: 2151 - Pages: 9
...Assignment 2 1. Write a function that takes an array of int as a parameter and returns a count of odd numbers in the array. Assume the array has MAX elements where MAX is a global constant int. That means that before all of the functions there is a declaration like: const int MAX = 10; And arrays are declared like: int myArray[MAX]; Note: if you are having trouble with the array questions, be sure to work through the “Building Block” problems in this module first. 2. Write a function that takes an array of int as a parameter and returns the sum of odd numbers in the array. Assume the array has MAX elements where MAX is a global constant int. 3. Rewrite your answer to the previous question as a recursive function. 4. Write a function that is passed two parameters: a one-dimensional array of int values, and an int value. The function finds the value in the array that is closest in value to the second parameter. For example, if the array had the values {5, -3, 18, 9, 4} and the second parameter was 11, then the function would return 9, because 9 is the closest value in the array to 11. If two values are equally distant, return either. In the previous example, if the second parameter was 7, either 5 or 9 could be returned. Assume the array has MAX elements where MAX is a global constant int. 5. Write a function that initializes the components of a two-dimensional array in the following manner: components above the upper-left to lower-right diagonal should be set...
Words: 472 - Pages: 2
...Handout: Problem Solving and 'C' Programming Version: PSC/Handout/1107/1.0 Date: 16-11-07 Cognizant 500 Glen Pointe Center West Teaneck, NJ 07666 Ph: 201-801-0233 www.cognizant.com Problem Solving and C Programming TABLE OF CONTENTS About this Document ....................................................................................................................6 Target Audience ...........................................................................................................................6 Objectives .....................................................................................................................................6 Pre-requisite .................................................................................................................................6 Session 2: Introduction to Problem Solving and Programming Languages ...........................7 Learning Objectives ......................................................................................................................7 Problem Solving Aspect ...............................................................................................................7 Program Development Steps .......................................................................................................8 Introduction to Programming Languages ...................................................................................14 Types and Categories of Programming Languages...
Words: 4320 - Pages: 18
...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
..._____. a. element in an array b. alternate name for an array c. number that represents the highest value stored within an array d. number that indicates the position of a particular item in an array 2. Each variable in an array must have the same _____ as the others. a. data type b. subscript c. value d. memory location 3. Each data item in an array is called a(n) _____. a. data type b. subscript c. component d. element 4. The subscripts of any array are always _____. a. integers b. fractions c. characters d. strings of characters 5. Suppose you have an array named number, and two of its elements are number[1] and number[4]. You know that _____. a. the two elements hold the same value b. the array holds exactly four elements c. there are exactly two elements between those two elements d. the two elements are at the same memory location 6. Suppose you want to write a program that inputs customer data and displays a summary of the number of customers who owe more than $1,000 each, in each of 12 sales regions. Customer data variables include name, zipCode, balanceDue, and regionNumber. At some point during record processing, you would add 1 to an array element whose subscript would be represented by _____. a. name b. zipCode c. balanceDue d. regionNumber 7. The most useful type of subscript for manipulating arrays is a _____. a. numeric constant b. variable c. character d. filename 8. A program contains a seven-element array that holds the names of...
Words: 843 - Pages: 4
...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 was...
Words: 9878 - Pages: 40
...http://cplusplus-answers.blogspot.com/search?q=10552 1 Marks: 1 Characters or symbols that perform operations on one or more operands are: Choose one answer. | a. Syntax | | | b. Op codes | | | c. Operators | | | d. Program ops | | | e. None of the above | | Correct Marks for this submission: 1/1. Question2 Marks: 1 Programmer-defined names of memory locations that may hold data are: Choose one answer. | a. Operators | | | b. Variables | | | c. Syntax | | | d. Operands | | | e. None of the above. | | Correct Marks for this submission: 1/1. Question3 Marks: 1 Which of the following best describes an operator? Choose one answer. | a. An operator is a rule that must be followed when constructing a program. | | | b. An operator allows you to perform operations on one or more pieces of data. | | | c. An operator marks the beginning or ending of a statement, or is used to separate items in a list. | | | d. An operator is a word that has a special meaning. | | | e. An operator is a symbolic name that refers to a variable. | | Correct Marks for this submission: 1/1. Question4 Marks: 1 What does the term hardware refer to? Choose one answer. | a. The relative difficulty of programming | | | b. The physical components that a computer is made of | | | c. The way a computer's storage space is organized | | | d. The logical flow of instructions | | | e. None of the above...
Words: 10107 - Pages: 41
...grades should be stored in a two-dimensional (doubly subscripted) array of double numbers. The student's name should be stored in a single-dimensional string array. The student's course should be stored in a single-dimensional string array. Allow the program to store up to 100 students' grades. Once the student's grades have been added, display the student's name, course and average grade in the list box. The list box sorted property should be set to true. To edit a student's grades, select an entry from the list box. You will need to search through the students name array to find a match. Pull the information from the arrays and put them in the controls in the submit area. Disable the student's name and course text boxes, list box, and Edit and Delete buttons. The user may only modify the grades. These will be updated in the grades array and the average redisplayed in the list box. When a student's grades are deleted, physically move the data up in the arrays. See the Sample Output below for further instructions. Pseudocode: Declare this at the top of the form class // initialize number of students to zero int studentCount = 0; // one-dimensional array to store student names string[] studentNamesAr = new string[100]; // one-dimensional array to store course numbers string[] courseAr = new string[100]; // two-dimensional array to store grades int[,] gradesAr = new int[100, 4]; ...
Words: 733 - Pages: 3
...An Introduction to R Notes on R: A Programming Environment for Data Analysis and Graphics Version 3.2.0 (2015-04-16) W. N. Venables, D. M. Smith and the R Core Team This manual Copyright c Copyright c Copyright c Copyright c Copyright c is for R, version 3.2.0 (2015-04-16). 1990 W. N. Venables 1992 W. N. Venables & D. M. Smith 1997 R. Gentleman & R. Ihaka 1997, 1998 M. Maechler 1999–2015 R Core Team Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the R Core Team. i Table of Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 Introduction and preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 2 Intrinsic attributes: mode and length . . . . . . . . . . . . . . . . . . . . . . . . . . . ...
Words: 8172 - Pages: 33
...VBScript IP File Lab Objectives In this lab, students will complete the following objectives. * Create a VBScript program using NotePad++. * Write a two-dimensional array of IP addresses to a text file. * Read the IP Addresses text file into a script. * Append new Room/PC/IP address data to the text file. * Use the object Scripting.FileSystemObject. Lab Diagram During your session you will have access to the following lab configuration. Connecting to your lab For this lab, we will only need to connect to Vlab-PC1. * Vlab-PC1 To start simply click on the named Workstation from the device list (located on the left hand side of the screen) and click Power on in the tools bar. In some cases the devices may power on automatically. During the boot up process an activity indicator will be displayed in the name tab. * Black—Powered Off * Orange—Working on your request * Green—Ready to access If the remote console is not displayed automatically in the main window (or popup) click the Connect icon located in the tools bar to start your session. If the remote console does not appear please try the following option. * Switch between the HTML 5 and Java client versions in the tools bar. In the event this does not resolve your connectivity problems, please visit our Help/Support pages for additional resolution options. Task 1: Create the IP_FileWrite.vbs Program Note: All captures must be text only—DO NOT capture the NotePad++...
Words: 2335 - Pages: 10
...Program 1: Write a program to copy the contents of one array into another in the reverse order. Code: #include<stdio.h> int main() { int arry1[10],arry2[10]={0},i,j; printf("Enter the elements of array: \n"); for(i=0;i<10;i++) { printf("Enter element %d:",i+1); scanf("%d",&arry1[i]); } i=0; for(j=9;j>=0;j--) { arry2[j]=arry1[i]; i+=1; } printf("Array elements in reverse order are: \n"); for(i=0;i<10;i++) { printf("element %d:%d \n",i+1,arry2[i]); } return(0); } Output: Program 2: If an array arr contains n elements, then write a program to check if arr[0] = arr[n-1], arr[1] = arr[n-2] and so on. Code: #include<stdio.h> int main() { int arry1[10],i,j,k=0; printf("Enter the 10 elements of array: \n"); for(i=0;i<10;i++) { printf("Enter element %d:",i+1); scanf("%d",&arry1[i]); } j=9; for(i=0;i<5;i++) { if(arry1[i]==arry1[j]) { printf("Elemets %d and %d are same \n", i+1,j+1); k=1; } j--; } if(k==0) { printf("No match found\n"); } return(0); } Output: Program 3: Find the smallest number in an array using pointers. Code: #include<stdio.h> int main() { int arry1[10],i,*j,k=10000; printf("Enter the 10 elements of array: \n"); for(i=0;i<10;i++) { printf("Enter element %d:",i+1); scanf("%d",&arry1[i]); } j=&arry1[0]; for(i=0;i<9;i++) ...
Words: 1358 - Pages: 6