## Develop a menu-driven program that inputs a number x, and at the user’s choice, finds and displays the

RAPTOR

Develop a menu-driven program that inputs a number x, and at the user’s choice, finds and displays the area (A) of one of the following:
A square with side X (use A = X^2)
A circle with radius (use A = 3.14 * X^2)
A equilateral triangle with side X (use A = sqrt (3)/4 * X^2)
Use a function for the area of each shape.

## In the accounting department, when entering a student’s name, the data entry person entered the

1. In the accounting department, when entering a student’s name, the data entry person entered the parts of the name in the following form: lastName, firstName—that is, the last name, followed by a comma, followed by the first name. Note that there is no space after the comma. For example, Steve Quinn’s name is entered as Quinn, Steve. The university needs to create mailing labels in which the names must be shown in the form: firstName, lastName, that is, first name followed by a space followed by last name. Write a program that takes as input a student’s name in the form lastName, firstName and then outputs the name in the form firstName, lastName.

(Hint: Read the input as a string. First use the indexOf method, from the String class, to find the index of the comma. Use the method length to find the length of the string and the method substring to extract the first name and the last name.)

Java Code:

2. Write a program that prompts the user to input a number. The program should then output the number and a message saying whether the number is positive, negative, or zero.

Java Code:

3. Write a version of a sequential search algorithm that can be used for sorted arrays and terminates when an element is encountered that is larger than the element for which you are searching. Also, write a program to test your selection sort algorithm.

Java Code:

4. Write a program that prompts the user to input three numbers. The program should then output the numbers in order (nondecreasing).

Java Code:

5. Write a value-returning method, is Vowel, which returns the value true if a given character is a vowel, and otherwise returns false.

Java Code:

6.Write a Java program that declares an array alpha of 50 elements of type double. Initialize the array so that the first 25 elements are equal to the square of the index variable, and the last 25 elements are equal to three times the index variable. Output the array so that 10 elements are printed on each line.

Java Code:

## CS 520 Homework 5

CS 520 Homework 5

Create a new Java Project in Eclipse named HW5_lastName and complete the following requirements. Create a package named cs520.hw5. Using this package, create the following classes. 1. Create a class named Student as follows. The class keeps track of the
student’s homework grades. This is a modification of HW3 using arrays. a.The instance (or member) private variables – name (String), homeworks (an integer array list). b. A single constructor with name as its argument. Also, initialize the homeworks array
list. c. The public get and set methods for the name instance variable. d.A void addHomeworkGrade method which takes one argument – the new homework grade. e.A public computeAverage method which takes no arguments and returns a double showing the average homework
grade for this student. f. Override the toString method to return the string representation of this object in the format “The ’s average grade is ”. 2. Create a Test class to test the following functionality in its main method. a. Declare and initialize an
empty Queue of Student objects named studentQueue. b. Declare and initialize an empty HashMap named studentMap. The keys will be the names of the students and the entries in the map will be the corresponding student objects. c.Use the BufferedReader class
to read the data.txt file. The contents of the file are shown below. Create the data.txt file in HW5_lastName. d. Read the contents of the text file one line at a time using a loop. The program should work for any number of input lines. In this loop, 1. Invoke
the processInputData method for each line read. This method returns the corresponding Student object. 2. Add this Student object to the studentQueue. 3. Insert this Student object into the studentMap using the student’s name as the key. e. After the loop is
processed, do the following. 1. Iterate over the studentQueue and display each element to the console. 2. Access the keys of the studentMap and assign them to an appropriate variable. Create an iterator over the keys. Iterate over each key in this set and
display the associated object in the map to the console. Write a private method processInputData with return type Student which processes its string input argument and returns the corresponding Student object as follows. 1. Tokenize the string argument using
the StringTokenizer class using the comma as the delimiter, or using the String split method. 2. Extract the name token. Create a Student object and assign to the local variable currentStudent. 3. Using a while loop, read the next homework grade token. Use
the addHomeworkGrade method on the student object to add the homework grade for this homework. 4. Display the string representation of the currentStudent object to the console. 5. The method should return the currentStudent object.

## IT 210 Week 6 Individual Currency Conversion

IT 210 Week 6 Individual Currency Conversion

Generate a set of test inputs and expected results for the Currency Conversion program. Make sure you have test case for each module in your design.  Test positive results as well as negative results (errors). You should include overall test cases; these test cases test the process from start to finish.

Post the test procedure as an attachment.

## IT 210 Week 5 Simple Array Process

IT 210 Week 5 Simple Array Process

Checkpoint: 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. 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.

Complete Ch. 6, Exercise 3, on p. 198. You are required to generate only the pseudocode; no flow-charts are required.

Post the assignment as an attachment.

Please make sure you review the example solution provided in Appendix K in the Course Materials forum.

## IT 210 Week 4 Appendix H

IT 210 Week 4 Appendix H

CheckPoint:

In one of the week 3 discussion questions we discussed the algorithm that would be required to make a peanut butter sandwich. In this CheckPoint you will need to take that one step further and create a program design to make a peanut butter sandwiches. In Appendix H in theCourse Materials forum you will find a partial program design; you need to complete it by adding the pseudocode in the required areas. You need to add one repetition (loop) control structure and one decision control to complete the program design. The user will decide how many sandwiches are made; this is where the loop will be used. The user will decide if the sandwich includes jelly, and, if it does, what flavor of jelly; to keep it simple we are only allowing grape or strawberry jelly.

Design a program with pseudocode that solves this problem.

Post the assignment as an attachment.

Your solution should look like the example provided in Appendix E in theCourse Materials forum; it must include the program analysis (process, input, and output) and the pseudocode.

Individual:

Complete the flowcharts and pseudocode in Appendix I in theCourse Materials forum based on the Currency Conversion requirements and Input-Process-Output table you generated in Week Two.

Develop the program design.

Post the assignment as an attachment.

## IT 210 Week 3 Appendix G

IT 210 Week 3 Appendix G

You work for a county court and need to design a program to calculate the total on a speeding tick. Each line of the table in Appendix G in the Course Materials forum indicates a MPH over the speed limit range and corresponding calculations for the fine and court costs for the range. Given a MPH over the speed limit, the fine is calculated by adding the base fine for the MPH over the speed limit range to the over the limit multiplier, the court costs are determined by court cost multiplier, and the total fine is the sum of the fine and the court costs. – Please see Appendix G in the Course Materials forum for more details. You must use the Selection Control structure to determine the calculation at the different MPH over the speed limit.

Design a program with pseudocode that solves this problem.

Perform a design walkthrough to verify your design.

Post the assignment as an attachment.

Your solution should look like the example provided in Appendix E in the Course Materials forum; it must include the program analysis (process, input, and output) and the pseudocode.

Appendix G

Sequential and Selection Process Control Structure

In the following example, the third line of the table specifies that the fine on a speeding ticket that is 11 MPH over the speed limit is \$75.00 plus 150% of the MPH over the speed limit, the court cost is 40% of the fine, and the total fine is the sum of the fine and the court cost. Therefore, the fine on a speeding ticket that is 11 MPH over the speed limit is \$75 + (11 * 1.5) = \$91.50, the court cost is 91.50 * .4 = \$36.60, and the total fine is \$128.10.

 MPH Over Speed Limit Fine Court Cost Total Fine 0 – 4 MPH \$25 + 100% of MPH over speed limit 20% of fine Fine + Court Cost 5 – 9 MPH \$50 + 125% of MPH over speed limit 30% of fine Fine + Court Cost 10 – 14 MPH \$75 + 150% of MPH over speed limit 40% of fine Fine + Court Cost 15 – 19 MPH \$100 + 175% of MPH over speed limit 50% of fine Fine + Court Cost 20+ MPH \$150 + 200% of MPH over speed limit 75% of fine Fine + Court Cost

## Design an algorithm that will read a file of student letter grades and corresponding grade points

RAPTOR

Design an algorithm that will read a file of student letter grades and corresponding grade points and load them into two paired arrays, as follows:
A 12
B 9
C 6
D 3
F 0
Your program is to read each record on the file (which contains a letter grade followed by a grade point), validate the letter grade (which must be A, B, C, D or F), check that the grade point is numeric, and load the values into the parallel arrays. Your program is to stop processing when the file reaches EOF or the arrays are full. Print an error message if there are more records on the file than elements in the array.

## CSC 101 Programming Assignment # 5

CSC 101 Programming Assignment # 5
Program:​

Your task is to create a class that will model a complex number. In much the way that our example class in chapter 7 was a class that modeled a Fraction.

A complex number is a number of the form a + bi, where a is the “real” part and b is the “imaginary” part. It is based on the mathematical premise that i2 = -1. So like the fraction class, you will define two data members for real and imaginary.

​Your class will contain the following 17 methods:
-A constructor that takes no arguments and assigns all values to 0.
-A constructor that takes one double and assigns it to the “real” portion, 0 to the other.
-A constructor that takes two doubles, and assigns them to real, then imaginary.
– 2 accessors
– 2 mutators
-A toString( ) method, outputting a String neatly in the form a + bi
​​
​Mathematical Methods- Instance methods

-2 different add methods, first takes one complex object as a parameter, the second ​takes a ​double (which is treated as the real portion of a complex only)
-2 subtract methods
-2 multiply methods
-2 divide methods
-An equals( ) method that takes a complex number as a parameter type and returns a ​boolean of true if the object is equal to the parameter.

These mathematical methods will be called like this:

NOTES:​You will also be required to create a tester file that successfully tests all your class methods. Remember: All of these mathematical methods will have only one complex number passed in as a parameter, the other is the object that is calling the method. If you get it to work but you are passing two complex objects, you are doing it wrong!!!!!!!!!

Each of these programs must be done in a separate file. Name them Complex.java, ComplexTester.java. Name the class in each file these names as well. If you do not name these files correctly you will lose points.

Hand in electronically – (NOT E-mail!!!)
In S-drive CSC 101 folder:
1. Create folder called projectfive_firstname_lastname
2. Place two files named above in folder. (NOTHING ELSE)

Complex Math: ​A + Bi refers to A = real portion; B = imaginary portion

A + Bi plus a real number C => ​(A + C) + (B)i

A + Bi ​ plus C + Di ​=> ​​(A + C) + (B + D)i

Subtracting:​​​​​resulting complex number

A + Bi minus a real number C => ​(A – C) + (B)i

A + Bi ​ minus C + Di ​=> ​​(A – C) + (B – D)i

Multiplying:​​​​​resulting complex number

A + Bi times a real number C => ​(A * C) + (B * C)i

A + Bi ​ times C + Di ​=> ​​(AC – BD) + (AD + BC)i

Dividing:​​​​​resulting complex number

A + Bi divided by a real number C => ​(A / C) + (B / C)i

A + Bi ​ divided by C + Di ​=> ​(AC+BD)/(C2 + D2) + (BC-AD)/(C2 + D2)i

​Note: make sure C2 + D2 is not equal to zero

Equals:
means real portions of each must be the same and imaginary portions must be the same

## In this program, there will be 3 classes. Your test program will input a start and end number of seconds.

In this program, there will be 3 classes. Your test program will input a start and end number of seconds. Call the CounterController only from your test program. The controller will create an instance of CounterModel with the initial value and call increment until the end value is reached. The CounterModel will wait 1 second, increment its counter and then display its counter by calling CounterView. Use Thread.sleep(1000); to delay 1 second.

Example Output:

——————–Configuration: <Default>——————–

This progam tests a timer.

Enter a start number of seconds

5

Enter an end number of seconds

11

CounterController Starting.

6…

7…

8…

9…

10…

11…

Continue?(y/n)

y

Enter a start number of seconds

0

Enter an end number of seconds

4

CounterController Starting.

1…

2…

3…

4…

Continue?(y/n)

n

Process completed.

## CIS355A Week 7 Course Project Flooring Application User Manual and Application Code

CIS355A Week 7 Course Project Flooring Application User Manual and Application Code

Your application must include at least three tabs. The user will choose wood flooring or carpet, enter the length and width of the floor, as well as the customer name and address. The application will compute the area of the floor and the cost of the flooring considering that wood floor is \$20 per square foot and carpet is \$10 per square foot. A summary should be displayed, either in a tab or another window, listing the customer name and address, floor selection, area, and cost. This information should also be stored in the MySQL database table. The program should validate that all information is entered and that the length and width are numeric values. Any numeric or currency values must be formatted appropriately when output. Recommendations for the components used for input are
• radio buttons—flooring type (wood or carpet);
• text fields—customer name, customer address, floor length, and floor width; and
• buttons—calculate area, calculate cost, submit order, display order summary, display order list.
The MySQL database table is called flooring and has the following description.
Field Type
CustomerName varchar(30)
FlooringType varchar(10)
FloorArea Double
FloorCost Double
In addition to entering new customer orders, your application should list all customer orders stored in the database. These will be viewed as a list, in a text area, and will not be updated by the user.

User Manual (Due Week 7)
Your actual Course Project and user manual are due at the end of Week 7. However, it is strongly recommended that you start your project in Week 5 to avoid many last minute issues.
In Week 7, you will be required to submit a user manual, as well as your Java code. The user manual can be a simple Word document with screenshots that explains how to run your application. Your mark will depend both on the program quality and the quality of the user manual.
Here are some more detailed guidelines about the user manual.
It does not need to be long, probably not more than 5 pages, including screenshots.
Write at the expected user’s level, not too technical.
Detail all the functionality that the application provides.
For each function, show what is its purpose and sample execution, with a screenshot.

User Manual Points Description
Sufficient length to describe the application 5 Manual contains explanation in detail of all relevant areas of the application
Contains screenshots of the key interface components 5 Images of each section of the application
Operations are explained 5 Detailed operation of each section of the application
Written to the user’s level and is not technical 5 Must not contain code or any other technical items irrelevant to the users
Subtotal 20

Application Code (Due Week 7)
The following grading rubric will be used for the code portion of the project.
Flooring Application Points Description
Standard header included 2 Must contain program name, student name, and description of the program
Program compiles 2 Program does not have any error
Program executes 2 Program runs without any error
Includes at least 3 tabs 10 Three or more tabs are used
Includes components for all required inputs 35 Components for customer name, address, floor type, length, width, area and cost with buttons to calculate area, calculate cost, display order summary, and display order list are included
Area calculation 4 Area is calculated correctly
Cost calculation 5 Cost is calculated correctly
Included data validation 10 If no values or non-numeric values are entered, the proper error message should display.
Correct data is stored in the database table 10 When values are entered, the data is stored correctly in the database table.
Customer orders are displayed in a list 10 All records saved to the database are displayed in a list with appropriate formatting.
Correct output is displayed 10 When values are entered, the order summary is shown with appropriate formatting.
Total 100

## PRICE  \$29.99

JAVA – The Local Driver’s License Office has asked you to write a program that grades the driver’s license exam.  The exam has 20 multiple choice questions.  Here are the answers:

1.B            2.D      3.A      4.A      5.C      6.A      7.B      8.A      9.C      10.D

11.B          12.C    13.D    14.A    15.D    16.C    17.C    18.B      19.D    20.A

A student must correctly answer 15 of the 20 questions to pass the exam.

Write a Data Element class that holds the data for one student.  There will be a student name and the student’s answers

Write a Data Manager class named DriverExam that holds the correct answers to the exam in an array field.  It will have methods to determine if a student passed, return the total correct answers, return the total incorrect answers, the questions missed.

Write a GUI class that allows the user to enter the student’s name and the student’s answers and then prints a report, showing the student’s name, if they passed or failed, the number of correct answers, the number of incorrect answers and a list of the questions missed.

Data Element Class – StudentExam

The class StudentExam will contain:

1. Contains instance variables of an array of char with the student’s answers to the questions and the student’s name.
2. Contains constructors and getter and setter methods

Data Manager Class – DriverExam

The class DriverExam will contain:

1. Contains instance variables of an array of char with the correct answers to the questions and a StudentExam object.
2. Method passedTest – returns true if the student passed the exam, or false if the student failed
3. Method numQuestionsCorrect – returns the total number of correctly answered questions
4. Method numQuestionsIncorrect – returns the total number of incorrectly answered questions
5. Method whichQuestionsMissed – returns an ArrayList<Integer> containing the question numbers of the questions that the student missed
6. Method report – pass in a student name and char[] of answers, returns a String with the exam report.  Creates a StudentExam object.  Creates and returns a string with a report that looks like the following:

<Student Name> <PASSED or FAILED>

Correct: <totalCorrect> Incorrect: <totalIncorrect> Questions missed: <NONE or question numbers>.  Call the methods of passed, totalCorrect, totalIncorrect and questionsMissed to create this report.

GUI Driver Class –  GUIDriver

1. Contains instance variables for labels and textboxes, buttons,.. for the user to put in the student name and the answers to the 20 Driver’s License Exam and a Driver Exam object.
2. Implements the ActionListener to listen for the Grade button.
3. Validate grades entered.  If not ‘A’, ‘B’, ‘C’ or ‘D’, display an error message using a dialog box.
4. When the Grade button is clicked, the Student name and the 20 grades are extracted from the textboxes and the report method (and only the report method) of the DriverExam class will be called. Display the Student’s name with the report in a dialog box.
5. When the Read File button is clicked, the Student name and the 20 grades are read from a file and then displayed in the appropriate textboxes.  Use a JFileChooser to allow the user to select the file to read from.  The file will contain the student name on the first line and then the second line will have 20 answers (A, B, C or D) separated by a space.  You can assume that the files are correct.

## Statements of earnings and financial position for Wexler Industries

9-27 (Objective 9-2, 9-3 , 9-4) On pages 279–280 are statements of earnings and financial position for Wexler Industries.
Required
a. Use professional judgment in deciding on the preliminary judgment about materiality for earnings, current assets, current liabilities, and total assets. Your conclusions should be stated in terms of percents and dollars.
b. Assume that you define materiality for this audit as a combined misstatement of earnings from continuing operations before income taxes of 5%. Also assume that you believe there is an equal likelihood of a misstatement of every account in the financial statements, and each misstatement is likely to result in an overstatement of earnings. Allocate materiality to these financial statements as you consider appropriate.
c. As discussed in part b, net earnings from continuing operations before income taxes was used as a base for calculating materiality for the Wexler Industries audit. Discuss why most auditors use before-tax net earnings instead of after-tax net earnings when calculating materiality based on the income statement.
d. Now, assume that you have decided to allocate 75% of your preliminary judgment to accounts receivable, inventories, and accounts payable because you believe all other accounts have a low inherent and control risk. How does this affect evidence accumulation on the audit?
e. assume that you complete the audit and conclude that your preliminary judgment about materiality for current assets, current liabilities, and total assets has been met. The actual estimate of misstatement in earnings exceeds your preliminary judgment. What should you do?

Consolidated Statements of Earnings
Wexler Industries (in thousands)

For 53 wks ended For the 52 wks ended
March 30, 2009 March 31, 2008 April 1, 2007
Revenue
Net Sales \$8,351,149 \$6,601,255 \$5,959,587
Other Income 59,675 43,186 52,418
Total Revenue 8,410,824 6,644,441 6,012,005

Costs and Expenses
Cost of Sales 5,197,375 4,005 548 3,675,369
Marketing, general,
Provision for loss
on Restructured Operations 64,100 -0- -0-
Interest Expense 141,662 46,737 38,546
Total COGS 7,993,217 6,171,875 5,542,080

Earnings from continuing
operations before income
tax 417,607 472,566 469,921
Income Taxes (196,700) (217,200) (214,100)
Earnings from continuing
operations 220,907 255,366 255,821
Provision for loss on
discontinued operations,
net of income taxes (20,700) -0- -0-

Consolidated Statements of Financial Position
Wexler Industries (in Thousands)
Assets March 30, 2009 March 31, 2008
Current Assets
Cash \$39,683 \$37,566
Temporary investments,
including time deposits
of \$65,361 in 2009 and
\$181,589 in 2008 (at cost) 123,421 271,639
Receivables, less allowances
of \$16,808 in 2009 and
\$17,616 in 2008 899,752 759,001
Inventories
Finished product 680,974 550,407
Raw Materials and supplies 443,175 353,795
Total 1,124,149 904,202
Deferred Income Tax Benefits 9,633 10,468
Prepaid Expenses 57,468 35,911
Current Assets 2,254,106 2,018,787
Land, Bldgs, and Equip,
at cost less A/D 1,393,902 1,004,455
Investments in affiliated
companies and sundry assets 112,938 83,455
Goodwill and other
intangible assets 99,791 23,145
Total 3,860,737 3,129,842

Liabilities and Stockholder’s Equity March 30, 2009 March 31, 2008
Current Liabilities
Notes Payable \$280,238 \$113,411
Current Portion of long-term debt 64,594 12,336
Accounts and drafts payable 359,511 380,395
Accrued salaries, wages, and vacation 112,200 63,557
Accrued income taxes 76,479 89,151
Other accrued liabilities 321,871 269,672
Current Liabilities 1,214,893 928,522
Long-Term Debt 730,987 390,687
Other noncurrent liabilities 146,687 80,586
Deferred income taxes 142,344 119,715
Stockholder’s equity
Common stock issued,
51,017,755 shrs in 2009
and 50,992,410 in 2008 51,018 50,992
Additional paid in capital 149,177 148,584
Cummulative foreign currency
Retained earnings 1,554,170 1,462,723
Common stock held in treasure,
at cost, 1,566,598 shrs (51,967) (51,967)
Stockholders Equity 1,625,826 1,610,332
Total \$3,860,737 \$3,129,842

## Global Products, Inc. has been making an electronic appliance for the domestic market.

1.2 Pricing in Two Markets Global Products, Inc. has been making an electronic appliance for the domestic market. Demand for the appliance is price sensitive, and the demand curve is known to follow the linear function D = 4000— 5P, where D represents annual demand and P represents selling price in the home currency, which is the Frank (F). The cost of manufacturing the appliance is 100F.

For the coming year, Global is planning to sell the same product in a foreign market, where the currency is the Marc (M). From surveys, the demand curve in the foreign country is estimated to follow a different linear function, D = 2000— 2P, where the price is denominated in Marcs.

All production will be carried out at Global’s domestic plant, with the expectation that the unit cost will remain unchanged. The exchange rate is 1.5 M/F, and Global plans to offer an equivalent price in both markets.

1. If Global were to operate exclusively in its domestic market, what would be its profit-maximizing price and its annual profit?
2. When Global sells in both markets at one equivalent price, what is its profit-maximizing price and its annual profit?
1.5 Allocating Plant Output A firm owns five manufacturing plants that are responsible for the quarterly production of an industrial solvent. The production process exhibits diseconomies of scale. At plant p, the cost of making x thousand pounds of the solvent is approximated by the quadratic function f(x) = (1/cp)x2. The parameters cp are plant dependent, as shown in the table.

 p 1 2 3 4 5 cp 3 6 4 8 5

The quarterly volume requirement is 50,000 pounds.

How should production be allocated among the five plants in order to minimize the total cost of meeting the volume requirement?

## CIS 170A iLab 7

CIS 170 CIS/170 CIS170 CIS170A Visual Basic Week 7 – ILab 7 – Lab 7 – Hockey Player The User Shall Be Able To Input Information For Multiple Players

The following are the new requirements that need to be added to the Week 5 Hockey Player Statistics Program:

The user shall be able to input information for multiple players. After each player and the number of seasons information is input, the program shall write the summary information for the player to a file called “PlayerStats.txt”. Any previous information that is saved in the file shall be preserved and not lost.
Once a player’s summary information has been written to the file, the program shall automatically clear all the input fields and output information for the player and be ready to accept data about another player.
Create a second form titled “Player Summary” that shall have operations to open the “PlayerStats.txt” file and display all the summary records for all the saved players.
The Player Summary form shall have an operation to clear the contents of the “PlayerStats.txt” file.
Exception handling for file operations shall be included to prevent the program from crashing when the files are opened or read.
The main form (frmHockeyStats) shall contain a menu that will have two menu items: “File” and “Tools”.
Under the “File” menu, there shall be menu items to “Clear” the fields and “Exit” the application.
Under the “Tools” menu, there shall be menu items to “Get Player Statistics” and “Summary Data” that opens the summary information forms.
Each control (except labels) will have a Tooltip with a short, user-friendly description of what the control provides.

## CIS 170A iLab 6

CIS 170A iLab 6

Create a program, using an array, which keeps a list of the rent rates for an apartment building. The rent rate for an apartment depends on which floor the apartment is located on and every apartment on the same floor has the same rent rate. The program shall read the name of the apartment building, how many floors the apartment building has, and get the rental rates for each of the floors. Once the rental rates are provided, the program shall list the rates. The program user shall be able to provide a floor number and the program will display the apartment building name, the total number of floors, the requested floor, and how much the rent is for the given floor.

The customer has several apartment buildings to choose from. The smallest apartment building has three floors and the largest apartment building has 20 floors. The program shall validate that the floor number is between the minimum and maximum floor values. Also, the minimum rental rate for any building is \$1,000 per month, while the highest rent is \$2,500. The program shall validate that the provided rental rates are within the minimum and maximum rates.

Design Requirements:

In Week 7, we will expand on this program and in order to easily modify it, your program will incorporate the following design features:
1.      The design will be modular and the event handlers shall not contain any processing logic, but only invoke reusable modules.

2.      All minimum and maximum values shall be declared as constants.

3.      The user shall not be able to input the floor he or she wants to search for until after the apartment building name, the number of floors in the building, and the rent values for each of the floors in the building have been entered and validated.

4.      Declare rentlist, numFloors, and requestedFloor as form level variables. All other variables should be declared locally as required.

## CIS 170A iLab 5

CIS 170 CIS/170 CIS170 CIS170A Visual Basic Week 5 – ILab 5 – Lab 5 Hockey Player

The following are the new requirements that the customer need to have.

The customer has decided that he or she wants to change the upper limits for goals, assists, and seasons. He or she wants the upper limit of the seasons to be 25, the upper limit for the goals is 70, and the upper limit for assists will be 75.

As with most programs that collect names of individuals, the full name shall be broken into two parts: the first name and the last name. Both the first and last name must contain nonempty-string values.

The customer wants to keep track of how old the player was when he or she started playing hockey, so the program shall provide a field to collect and validate the age of the player when he or she was a rookie. The starting age shall be at least 18 years old and no more than 30 years old, and the age shall be displayed as part of the summary output.

The user cannot begin to collect season data until after the first name, last name, seasons, and age are all provided and validated.

Consider using the following pseudocode as a guide in developing the main processing algorithms of the program:

Main program (button’s event handler, btnProcess_Click)

Initialize program and declare variables

If ValidateString(“First name”, Me.txtFirstName.Text, strFirstName) = False, return.

If ValidateString(“Last name”, Me.txtLastName.text, strLastName) = False, return.

If ValidateInteger(“Age”, Me.txtAge.Text, intAge, 18, 30) = False, return.

If ValidateInteger(“Seasons”, Me.txtSeasons.Text, intSeasons, 1, 25) = False, return.

Call ProduceOutput(strFirstName, strLastName, intAge, intSeasons)

ValidateString Function

Parameters: strText (ByVal), strInput (ByVal), strValue (ByRef)

Checks to see if strInput is empty

If it is, displays error message and returns False

If it’s OK, then

strValue = strInput

Returns True

ValidateInteger Function

Parameters: strText (ByVal), strInput (ByVal), intValue (ByRef), intLowValue (ByVal), intHighValue (ByVal)

Checks to see if strInput is empty

If it is, displays error message and returns False

If it’s OK, then

intValue = strInput (transformed into Integer)

Checks inValue is within acceptable range

If not, displays error message, returns False

If it’s OK, then Returns True

ProduceOutput Sub

Parameters: strFirst (ByVal), strLast (ByVal), intPlayerAge (ByVal), intNoSeasons (ByVal)

Initialize display in listbox

Loop from 1 to intNoSeasons

Accept Goals with InputBox() function –> strInput

If ValidateInteger(“Goals”, strInput, intGoals, 0, 70) = False, go back to 2.a

Accept Assists with InputBox() function –> strInput

If ValidateInteger(“Assists”, strInput, intAssists, 0, 75) = False, go back to 2.c

Accumulate intGoals and intAssists

Display season data in listbox

Finalize display of data in listbox

Note that we use Functions and Subs in the logic above, and also note that although most parameters are passed By Value, we have a couple passed By Reference.  As long as you comply with the new user requirements described above and you use good modularization of the program, you can use any modularization technique desired. However, please keep in mind that “good” modularization for this particular Lab means:

Using Function modules;

Using Sub modules; and

Using ByVal and ByRef parameters

## CIS 170A iLab 4

CIS 170 CIS/170 CIS170 CIS170A Visual Basic Week 4

CIS 170A iLab 4

Create a program that will calculate and display the career statistics for a hockey player. The program will begin by allowing the user to enter the following information.

·         Name of the hockey player – The name must be a nonempty string.

·         Number of seasons played – The number must be at least one season and no more than 20 seasons.

Only after a valid season value is provided, processing of goals and assists can begin. The next step is to allow the user to provide additional information as follows.

·         Number of goals – A valid number of goals is between 0 and 60.

·         Number of assists – A valid number of assists is between 0 and 60.

The program will keep a running total of the following statistics.

·         Number of goals

·         Number of assists

·         Total points

A list of the each season’s data will be display after the season data are provided. Additionally, once all the season data are collected, the program shall list the summary information for the player and all the seasons.

## CIS 170A iLab 3

CIS 170 CIS/170 CIS170 CIS170A Visual Basic Week 3 – ILab 3

Lab 3 of 7: Decisions

Lab Overview – Scenario / Summary:

TCOs:

1. Given a set of program specifications for a simple business problem requiring one or more decisions, code and test a program that meets the specifications and employs best programming practices.

2. Given a program with syntax and logic errors, employ the debugger and other diagnostic tools to remove or correct the errors.

This lab will familiarize students with If/Else/EndIf statements and possible Select Cast statements by calculating the amount of money a drive-in movie theater makes in a single night.

Lab Steps:

Step 1: Create a New Project

Create a new Windows Forms project in VB.NET. Name your project CIS170A_Lab03.

Step 2: Program Description

In this program you will create a Windows Form application that will calculate and display the money made by a drive-in movie theater each night. The movie theater has two types of nights. A “Regular” night is where each person in a guest car has to buy a ticket, and each ticket costs \$10. A “Car” night is a special promotion where there is one price per car of \$15, no matter how many guests are in the car.

In addition to the cost of entry (either Regular or Car), the theater sells popcorn and candy but the price of the items depends on the type of night.  On a Regular night popcorn costs \$1.50 per box and on a special Car night popcorn costs \$2.00 per box. On a Regular night candy cost \$2.25 per candy box, while on a special Car night candy cost \$3.00 per box.

On any night, the maximum number of cars allowed in is 500 and the maximum number of individual tickets is 3,000; the theater can produce 4,500 bags of popcorn each night and has 4,000 candy items.

Once the total revenue is calculated, the program will display a summary message with the type of night, the total number of cars, the total ticket sales, the total popcorn sales, the total candy sales, and the total sales amount.

Consider using the following pseudocode as a guide in developing the main processing algorithm of the program:

Initialize program and create variables

Accept and validate NumberOfCars

Accept and validate TypeOfNight

If TypefNight = “R” Or “r”:

a)     Accept and validate Tickets

Accept and validate Popcorn

Accept and validate Candy

If TypeOfNight = “R” or “r”:

a)     Compute TotalPopcorn = Popcorn*1.5

b)     Compute TotalCandy = Candy* 2.25

c)     Compute Total = Tickets*10 + TotalPopcorn + TotalCandy

If strTypeOfNight = “C” or “c”:

a)     Compute TotalPopcorn = Popcorn*2

b)     Compute TotalCandy = Candy*3

c)     Compute Total = NumberOfcars*15 + TotalPopcorn + TotalCandy

Display the final message (TypeOfNight; NumberOfCars; TotalPopcorn; TotalCandy; and Total.)

In all cases where validation fails, the program should terminate and return control to the user (i.e., exit the event handler immediately.)

Notice that this logic is a bit simple-minded and goes “straight through”, without coming back to the beginning.  This is due to not yet having learned how to use the loop statements that will allow us to go back our logic to ask again for a value that was entered in error. (We cover that next week.)

Step 3: Suggested Form Design

You are free to experiment with form design and object colors as you see fit, even though as to colors we strongly recommend using the default colors for the form and all objects – this allows each user to see your form in their chosen Windows color palette.

The suggested form design is as follows:

Once the total sales are calculated, the program will display a summary message in a ListBox object with the following content:

type of night;

total number of cars;

total popcorn revenue;

total candy revenue; and

total revenue amount.

Step 4: Implement the Event Handlers

Consider using the following suggested TOE chart as guide in designing your program’s event handlers. As also noted in the pseudocode description above, the final calculation should NOT be completed unless all the input fields are validated as correct.

Object

Event

Accept and validate NumberOfCars

Accept and validate TypeOfNight

If TypefNight = “R” Or “r”:

a)     Accept and validate Tickets

Accept and validate Popcorn

Accept and validate Candy

If TypeOfNight = “R” or “r”:

a)     Compute TotalPopcorn = Popcorn*1.5

b)     Compute TotalCandy = Candy* 2.25

c)     Compute Total = Tickets*10 + TotalPopcorn + TotalCandy

If strTypeOfNight = “C” or “c”:

a)     Compute TotalPopcorn = Popcorn*2

b)     Compute TotalCandy = Candy*3

c)     Compute Total = NumberOfcars*15 + TotalPopcorn + TotalCandy

Display the final message (TypeOfNight; NumberOfCars; TotalPopcorn; TotalCandy; and Total.)

btnCompute

Click

Clear all textboxes and listbox [Hint: use method Items.Clear()]

btnClear

Click

Close form.

btnExit

Click

[Hint: To comply with the desire to avoid computing the totals if we have some problem in validation, consider using the Exit Sub statement in suitable locations within your code.]

Programming notes:

To check if a textbox is empty, use the String.IsNullOrEmpty method, such as:

If String.IsNullOrEmpty(txtName.Text) = True Then

To validate a numeric input (in the example below, intSeasons, an Integer value), consider the following suggested code:

If Integer.TryParse(Me.txtSeasons.Text, intSeasons) = False Then

MessageBox.Show(“Seasons must be numeric”, “Error”, _

MessageBoxButtons.OK, MessageBoxIcon.Error)

Me.txtSeasons.SelectAll()

Me.txtSeasons.Focus()

Exit Sub

Else

If intSeasons < 1 Or intSeasons > 20 Then

MessageBox.Show(“Seasons must be between 1 and 20”, “Error”, _

MessageBoxButtons.OK, MessageBoxIcon.Error)

Me.txtSeasons.SelectAll()

Me.txtSeasons.Focus()

Exit Sub

End If

End If

Please remember to set Option Strict On and also to supply profuse internal documentation in your program.

Step 6: Deliverables

Zip up the top-level folder with your program (the complete set of project files) into a single file (please check Doc Sharing for details.)

Rename that .zip file as CIS170A_Lab03_LastName_FirstInitial.zip, or similar.

Place deliverables in the Dropbox.

END OF LAB

## CIS 170A iLab 2b

CIS 170 CIS/170 CIS170 CIS170A Visual Basic Week 2 – ILab 2 – Lab 2 B

Part B:  Arithmetic Operations

Step 1:  Create a New Project

Open a new project in VB.NET. Name your project CIS170A_Lab02_B

Step 2: Program Description

In this project, you will create a program that will provide the user the option of calculating the area of a square, the area of a circle, or the volume of a sphere.  The program will accept a single input from the user (length of side or length of radius) and depending on the button clicked by the user, the program will compute either the area of a square with the length as a side; the area of a circle with that value as the radius; or the volume of a sphere with that value also as a radius.

The corresponding mathematical formulas are as follows:

Area Of Square = Length x Length (or also Length raised to the power of 2)

Area of Circle = Pi x Radius squared

Volume of Sphere = 4 / 3 x Pi x Radius raised to the power of 3

(where Pi = 3.1416)

Step 3: Suggested Form Design

You are free to experiment with form design and object colors as you see fit, even though as to colors we strongly recommend using the default colors for the form and all objects – this allows each user to see your form in their chosen Windows color palette.

The suggested form design is as follows:

Here we show some sample data entered in the textbox, and the result of the user having then clicked on the “Square” button.

Note that in this case we display the results in a big label located in the center of the form.  Please consider the following values for two of that label’s properties:

AutoSize = False

BorderStyle = Fixed3D

Step 4: Implement the Event Handlers

. Use the following as the design for your event handlers:

Object

Event

Make sure that the textbox has a valid numeric value. [Hint: use the Double.TryParse() method.]

Assign the converted input value to dblInput

Compute AreaOfSquare

Display “The area of a square with side xxx is yyy”, where “xxx” is dblInput and “yyy” is AreaOfSquare.

btnSquare

Click

Make sure that the textbox has a valid numeric value. [Hint: use the Double.TryParse() method.]

Assign the converted input value to dblInput

Compute AreaOfCircle

Display “The area of a circle with radius xxx is yyy”, where “xxx” is dblInput and “yyy” is AreaOfCircle.

btnCircle

Click

Make sure that the textbox has a valid numeric value. [Hint: use the Double.TryParse() method.]

Assign the converted input value to dblInput

Compute VolumeOfSphere

Display “The volume of a sphere with radius xxx is yyy”, where “xxx” is dblInput and “yyy” is VolumeOfSphere.

btnSphere

Click

Clear textbox and output label.

btnClear

Click

Close form

btnExit

Click

Please be sure to convert the numeric values to the appropriate data type when displaying the results.

Step 5:  Deliverables

Zip up the top-level folder with your program (the complete set of project files) into a single file (please check Doc Sharing for details.)

Rename that .zip file as CIS170A_Lab02_B_LastName_FirstInitial.zip, or similar.

Place deliverables in the Dropbox.

END OF PART B

END OF LAB 2