CSC 221



CSC115, Instructor: Zhen Jiang, Project 3.

Submit both answer sheet (word) and m-script file via D2L. Late submission not accepted.

Use matlab to display the required information in the text.

Simple case

1) List all the client number, client name for any client who has a current due of more than $20,000.

Q1: Do you need a loop?

Q2: Can we combine the selected number (column) and the selected name (second column) together?

Q3: What is the code?

Top value selection (sorting and its use) with loop program

2) List the top 2 clients with the highest current due, in the descending order by current due. The display includes current due, client number, and client name.

← You have to sort the due records in the descending order, so that you can select the top values from the beginning.

← Using the original positions that were given by “sort”, select the top 2 items.

← You need to convert due to string format (in order to display together in one line) – num2str(due)

← One conversion each time, forcing the program handle the display information line by line.

Q1: What do you see, for the program in that box, to repeat many times?

Q2 (multiple questions): Verify the repetition body:

← What the computer do in the first round?

← What the computer do in the second round?

← What the computer do in the third round?

← What is the general format of that body?

Q3(multiple questions): Repetition body detail

← Is the execution of body optional?

Q4: For loop

◦ Do we know how many times to repeat?

Q5: Initialization

◦ How we handle the first line when the program do the part of your Q2(d) at the 1st time?

Q6: Final touch! What is the code (submit in m-script file)?

Calculated values

3) Show the number and name for each client, including a new column which is the sum of amount paid and current due.

← You need a new column result (by addition).

← You need to convert number to string format, line by line.

← One conversion each time, forcing the program handle the display information line by line.

Q1: What do you see, for the program in that box, to repeat many times?

Q2 (multiple questions): Verify the repetition body:

← What the computer do in the first round?

← What the computer do in the second round?

← What the computer do in the third round?

← What is the general format of that body?

Q3(multiple questions): Repetition body detail

← Is it optional?

Q4: For loop

◦ Do we know how many times to repeat?

Q5: Initialization

◦ How we handle the first line when the program do the part of your Q2(d) at the 1st time?

Q6: Final touch! What is the code (submit in m-script file)?

Decision and loop program

4) List the client numbers, client name, and current due for all clients that have a current due more than a value entered by the user

← You have to set the input value (by input command).

← You need to convert number to string format, line by line.

← During the data conversion, you need to check if it is needed to put into the display.

← One check and conversion each time, forcing the program handle the display information line by line.

Q1: What do you see, for the program in that box, to repeat many times?

Q2 (multiple questions): Verify the repetition body:

← What the computer do in the first round?

← What the computer do in the second round?

← What the computer do in the third round?

← What is the general format of that body?

Q3(multiple questions): Repetition body detail

← Is it optional?

← What the value to determine the selected case?

← Can you make the condition and what is that after your value verification process?

Q4: For loop

◦ Do we know how many times to repeat?

Q5: Initialization

◦ How we handle the first line when the program do the part of your Q2(d) at the 1st time?

Q6: Final touch! What is the code (submit in m-script file)?

Decision and loop program involving compound criteria AND & OR

5) List client numbers, client names, for all clients of recruiter “24” who have more than $5,000 due.

← You have to check the match of each record, not the whole array of string.

← One check each time, forcing the program handle the display information line by line.

Q1: What do you see, for the program in that box, to repeat many times?

Q2 (multiple questions): Verify the repetition body:

← What the computer do in the first round?

← What the computer do in the second round?

← What the computer do in the third round?

← What is the general format of that body?

Q3(multiple questions): Repetition body detail

← Is it optional?

← What the value to determine the selected case?

← Can you make the condition with && or || and what is that after your value verification process?

Q4: For loop

◦ Do we know how many times to repeat?

Q5: Initialization

◦ How we handle the first line when the program do the part of your Q2(d) at the 1st time?

Q6: Final touch! What is the code (submit in m-script file)?

6) List all client number and name whose amount paid is between $10K and $20K and lives in “Berls”.

← You have to check the match of each record, not the whole array of string.

← One check each time, forcing the program handle the display information line by line.

Q1: What do you see, for the program in that box, to repeat many times?

Q2 (multiple questions): Verify the repetition body:

← What the computer do in the first round?

← What the computer do in the second round?

← What the computer do in the third round?

← What is the general format of that body?

Q3(multiple questions): Repetition body detail

← Is it optional?

← What the value to determine the selected case?

← Can you make the condition with && or || and what is that after your value verification process?

Q4: For loop

◦ Do we know how many times to repeat?

Q5: Initialization

◦ How we handle the first line when the program do the part of your Q2(d) at the 1st time?

Q6: Final touch! What is the code (submit in m-script file)?

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download