Ask Computer Engineering Expert

Homework: Programming Structures

PROBLEMS -

Open a blank Excel workbook and save it as a MACRO-ENABLED file. Your workbook must contain only two worksheets named "Prob1" and "Prob2", respectively. Open the Visual Basic Editor (VBE) and insert a new module into the Project Explorer. You must write (NOT record) all your sub procedures inside this module.

Problem 1 -

a) Add a module (i.e., Module1) in the Project Explorer and write (do NOT record) all the code for this problem inside this module. Show your results in a worksheet labeled "Prob1".

b) Write a sub procedure that allows a user to create a list of individuals displaying their last name, first name and age, as well as the length of each of these data strings. Your sub procedure must do the following:

- Prompt the user for the total number of people to be entered in the spreadsheet via an input box. Assume that the user always enters a valid integer number in this step. The sub procedure must terminate execution if the "Cancel" button of this input box is pressed.

- Given the total number of entries provided, prompt the user to enter the age, first name, and last name for each person via another input box. This input box must display a default value prompting the user to enter each data string in the right order and separated by a comma. For example, the user must enter "45, Jenny, Jones" for the first person, "28, Mike, Pedersen" for the second, and so on. Each entry constitutes a record. Your program must use a repetition structure and, based on the number of records to be entered, present the same input box to meet this requirement. The sub procedure must NOT allow the user to terminate execution if the "Cancel" button of this input box is pressed.

- Your program must ignore any blank spaces entered before and/or after each string and only report the length of the actual string. For example, if a user enters "¢¢¢23¢¢,Lane¢¢¢¢¢¢¢¢¢¢,¢¢¢¢¢¢¢¢Louise", your program should report string lengths of 6, 4 and 2 for the last name, first name and age, respectively. The special character "¢" indicates a blank space in the example.

- Each record entered by the user must be separated into its individual components and displayed on the spreadsheet "Prob2" in separate cells, as shown in Figure 2. The first record entered by the user should be printed on row 3. Column B should display last names, column C should display the length of last names, column D should display first names, column E should display the length of first names, column F should display ages, and column G should display the length of ages. The columns headings can be entered by hand in the spreadsheet.

- You must use a variable of type Range in combination with the Offset property to enter each record in a row and each entry on a column.

- The interior color of every other row should be changed to improve the readability of individual records.

- Columns must automatically adjust their width to the length of the strings entered.

- The total number of records displayed on the spreadsheet should match the number of entries specified by the user.

c) Assign the sub procedure to a shape button.

2137_fiugre.png

Problem 2 -

Write a sub procedure that plays the game Ro-Sham-Bo (a.k.a., Rock, Paper, Scissors) for a player and a computer opponent. The player selects one of the options listed in an input box, then the computer randomly selects an option as well. The winner of the game is determined as follows:

Rock beats Scissors - Scissors beats Paper - Paper beats Rock

The same selection results in a tie.

Your sub procedure must do the following:

- The sub procedure should be named Ro_Sham_Bo.

- Prompt the player to enter a selection with an input box. Provide instructions to use the integers one, two, and three to represent the selection. Assume the player enters a valid choice (i.e., you do not need to validate the input), but allow the sub procedure to end if the cancel button is pressed.

- Generate another random value between 1 and 3 for the computer's choice with the same rules as for the player's choice.

- Display the player and the computer choices with the appropriate image in the spreadsheet. Also, display a label explaining the outcome (e.g., Rock Smashes Scissors!). Finally, if the player wins, display "You win!", if the computer wins, display "You lose!", and if the result is a tie display "No winner." 

- Place one second delays between displaying each of the three items listed above (image, explanation, and result).

Assign the sub procedure Ro_Sham_Bo to a rectangular shape button. The caption of the rectangular shape button should read "Ro - Sham - Bo!".

1963_figure1.png

Attachment:- Assignment Files.rar

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92718376

Have any Question?


Related Questions in Computer Engineering

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As