• 100% Satisfaction Guarantee
R.R. Jha, Tutor
Category: Homework
Satisfied Customers: 5471
Experience:  B.Tech
20870358
R.R. Jha is online now

# Excel 2010 Visual Basic Homework Help Problem 1: Hurricanes

Excel 2010 Visual Basic Homework Help

Problem 1:
Hurricanes are categorized based on wind speeds. Use the following table to write a (VB) script that will prompt the user for the wind speed, and will print the hurricane category number and the typical storm surge.

Category Wind Speed Storm Surge (in ft. above normal)
1 74-95 4-5
2 96-110 6-8
3 111-130 9-12
4 131-155 13-18
5 >155 >18

Problem 2:
Write the program in (VB) of a temperature conversion (temperature input in K to a temperature output in °C or °F). The inputs are: input1 is a number, input2 is a letter that is either "C" or "F" to represent Celsius and Fahrenheit, respectively. Deal with the possibility when the user gives the second input in small letter, or an invalid temperature unit. Also, consider when the user gives a negative number for input1!

Celsius= Kelvin -273 Fahrenheit = (Kelvin-273)*1.8+32

Problem 3:
Write a program in (VB) to determine if a given integer input: intYear, is a leap year or not.

Hint: For #3, use the built-in function mod in VB.

Pseudocode to determine whether a year is a leap year or not in either the Gregorian calendar since 1582 or in the proleptic Gregorian calendar between 1 and 1582:

if year is divisible by 400 then
is_leap_year
else if year is divisible by 100 then
not_leap_year
else if year is divisible by 4 then
is_leap_year
else
not_leap_year
Hi,

I'd be glad to help. I'll work over this and get back to you by tomorrow.

Thanks
Customer: replied 3 years ago.

Sure.

Ok, thanks
Customer: replied 3 years ago.

Hello, just seeing how things are going.

Hi,

https://www.box.com/s/680pupys9yi8trhi1wl8

It was time taking, bonus is appreciated.

Let me know when you need help with other problems. Just add 'RRJha' at the start of your new question to send it directly to me.

Thanks
Customer: replied 3 years ago.

Hello, i just have q quick question for you. Are you familiar with a program called MatLab? I have some programming questions in that software.

Hi,

I'm familiar with Matlab. Let me know how I could help.
Customer: replied 3 years ago.

Ok, here are two problems. Take a look at them and see if you can help. If you can I would need them around 12:00 central time tommorrow and we can negotiate a price. Thanks.

1. Write the program in Matlab and Excel Visual Basic:

The distance between any two points (X1,Y1) and (X2,Y2) is give by,

distance = squareroot((x1-x2)^2+(y1+y2)^2)

the area of a triangle is ,

area = squareroot(S*(S-A)*(S-B)*(S-C))

where A,B, and C are the lengths of the sides of the triangle, and S is equal to half of the sum of the three sides of the triangle. Write a script that will prompt the user to enter the coordinates of the three points that determine a triangle ( the X and Y coordinates of each point). The script will then calculate and print the area of the triangle. it will call one function to calculate the area of the triangle. This function will call a sub-function that calculates the length of the side formed by any two points (the distance between them).

2. Create in programming language of your choice a function called isLeapYear(intYear) that determines if the input year is a leap year or not. Write the main program to calculate the total days passed in a year for a given date. Prompt the user for the (integer) inputs: year, month, and day. The output is the total days passed since Jan 1st of that year excluding the input date (e.g., if the user gives 2012, 01, 23, then the output is 22). Call the function isLeapYear(intYear) to determine if the year is leap or not, if necessary.

Assumption: The user is intelligent enough to enter valid dates only. Example of invalid dates (yyyy/mm/dd): 2001/01/32, 2002/02/29 (2002 is non-leap), 2005/04/31 (April has only 30 days), etc. Tackling invalid dates is for Project #1. However, if you insist to deal with invalid dates in this HW, it will worth maximum 10 extra pts, by creating another function to check the validity of the input date before calculating the total days passed. Name the function isValidDate(intYear, intMonth, intDay).

For checking: Use built-in function DateDiff in VB to check your work. Note that the function DateDiff must be used for checking ONLY.

Expected I/O:
Enter year: 2012
Enter month: 3
Enter day: 15

Total day passed in 2012 before 3/15 = 74 days

Hi Cody,

Could you please clarify which programming language these need to be in? Because first one states Matlab and Visual Basic, while second one says programming language of your choice?
Customer: replied 3 years ago.

Yes, the first question wants the programming language in both VB and Matlab. The second one can be in either VB or Matlab but if you could do it in Matlab would work best for me. Anything else you need to know?

Ok, I could do that. Let me know if you could add \$40 bonus for all three program.
Customer: replied 3 years ago.

So, would i need to rehire you for 40 and pay a 40 bonus? Are you going to do the extra credit in the second question?

Yes, I would be doing extra credit one as well.
Customer: replied 3 years ago.

Ok. Sounds good to me.

Ok, then. I'll have them ready by tomorrow.
Customer: replied 3 years ago.

Ok, can i pay you tomorrow as well?

Sure, no problem. I'll post answer here which you rate and add bonus on.
Customer: replied 3 years ago.

Ok. Will do.

Customer: replied 3 years ago.

Hello, I'm just checking how things are going.

I know I posted my question Tuesday saying I needed it tomorrow (Wednesday) around noon central time. By the end of our conversation it was Wednesday (today) and I am just trying to confirm the date of which I need the assignment. I can have it as late as 3Pm central or 4pm EST today.

Sorry if I confused you but hopefully you understood my original time request. Thanks

Hi,

https://www.box.com/s/rpegori4flpq4vgh8iqj

Thanks in advance for the rating and bonus.

Let me know anytime you need help with any other problems.

You can request me by adding 'RRJha' at the start of your new question.

Thanks
Customer: replied 3 years ago.

Ok, thanks for the help. I don't have matlab on my computer and must go on campus to test the program. I will get back to you in a few hours and let you know how it goes. I will talk to you soon.

Ok
Customer: replied 3 years ago.

ok, i am having some errors with the coding.

For question one in VB and Matlab sometimes it tells me the area of the triangle is zero which cant be true.

What can i do to correct this?

Thanks

It can happen if the points are collinear, that is, all three points are in a straight line. Please make sure it isn't so. Here is an online calculator I found to cross check with

http://www.gottfriedville.net/mathtools/triarea.html
Customer: replied 3 years ago.

Ok, that makes much more sense. Thanks for your help and I might have some more for you tomorrow.

Your awesome, btw just 40 for the work?

Most welcome! You can add Bonus to make up as we discussed earlier.

Thanks
Customer: replied 3 years ago.

Ok, I got you taken care of. I will talk to you tomorrow.

Thank you, XXXXX XXXXX
Customer: replied 3 years ago.

Hello, I have some more things I could use some help on. I would need this by Friday around 5pm EST. I would like to know what you think.

Problem 1) Write the following code in Matlab and VB:

Hints: VB: Left, Right, InStr, Replace;

Matlab: strfind, strtok, strrep

Words in a sentence variable (just a string variable) called mysent are separated by right slashes (/) instead of blank spaces. For example, mysent might have this value:

'This/is/not/quite/right'

Write a function slashtoblank that will receive a string in this form and will return a string in which the words are separated by blank spaces. This should be general and work regardless of the value of the argument. No loops are allowed in this function; the built in string functions must be used.

>> mysent = 'This/is/not/quite/right';

>> newsent = slashtoblank(mysent)

newsent =

This is not quite right

Problem 2) With yesterdays homework you helped me with convert problem 2 to VB (you did that in Matlab) and by altering both the VB and Matlab code by,

2.1) By employing array vector in VB or a vector matrix in Matlab.

AND

2.2) By having Inout/Output as one line of string, with expected I/O:

Enter date: 2012/03/15

Total day passed in 2012 before 3/15 = 74 days

Ok, I'll work over these and Let you know.
Customer: replied 3 years ago.

Ok

Hi Cody,

https://app.box.com/s/1vjygi0bnii5zpxkqtnl

Thanks in advance for rating and bonus.

Let me know if I could offer any further help.

Thanks
Customer: replied 3 years ago.

Hello, I have some more work for you if your interested. I would need them by tommorrow night (Tuesday) before midnight 12:00 AM EST.

Question 1) Write the following program in MATLAB.

For a bio-medical experiment, the names and weights of some patients have been stored in a file named patwts.dat. For example, the file might look like this:

Darby George 166.2

Helen Dee 143.5

Giovanni Lupa 192.4

Cat Donovan 215.1

Create this data file first. Then, write a script readpatwts that will first attempt to open the file. If the file open is not successful, an error message should be printed. If it is successful, the script will read the data into strings, one line at a time. Print for each person the name in the form 'last,first' followed by the weight. Also, calculate and print the average weight. Finally, print whether the file close was successful. For example the results of running the script would look like this:

George,Darby 166.2

Dee,Helen 143.5

Lupa,Giovanni 192.4

Donovan,Cat 215.1

The average weight is 179.30

File close successful

Question 2)

Write the program in Matlab and VB, to calculate a root of a given formula and two initial conditions using Modified Secant method. In the program:

2.1. The formula should be given by the user as a string. Use the built-in function eval in Matlab, or Evaluate in VB to calculate the string expression.

2.2. Save the information in an output file for Matlab, printed to worksheet for VB, with the following format:(with [xxx] is the inputs from the user for each prompt)

=======================================================

Formula:

y = f(x) = [formula with x as independent variable]

Initial conditions:

a = [value of a]; f(a) = [value of f(a)]

b = [value of b]; f(b) = [value of f(b)]

Root:

x0 = [root of the problem]

y0 = [value of f(x0)]

====================================================

Received the files. I hope you'd be able to add \$40 as bonus. I'll send them before midnight tomorrow.

Thanks
Customer: replied 3 years ago.

Sure, not a problem.

Ok, thanks.
Just noticed that Question 2 is inputting two initial condition but Modified Secant method uses only one initial condition (but Secant method uses two). Let me know which one to program for question 2.
Customer: replied 3 years ago.

Use the secant method so you can input two initial conditions.

Ok.

https://app.box.com/s/nm57sj8xi61ty3wo1tqv

Thanks
Customer: replied 3 years ago.

Hello, thanks for the on time delivery. I just have some general questions over the software. Can you give me a brief lesson on how to use/run these programs and how they work?

Once again, thanks for your help.

For matlab scripts

http://ctms.engin.umich.edu/CTMS/index.php?aux=Extras_Mfile

For vba script, just open the file and click the button. It would call the script it's bound to.

Thanks
Customer: replied 3 years ago.

Hello, I have one more assignment for you. It involves creating a GUI in Visual Basic. I will receive extra credit for creating the same GUI in Matlab. Take a look at the parameters below an when do you think you have this done?

1. Write a GUI program in Visual Basic to calculate the time elapsed in between two specified instances to mimic VB’s (limited) DateDiff function.

2. Prompt the user two inputs of time instances in the format of:

Inputs:

Year: [in text box format]

Month: [in combo box or option button format]

Day: [in combo box format]

Hour: [in combo box or option button format]

Minute: [in combo box format]

Second: [in combo box format]

And a choice of time difference type:

Difference type: [in combo box or option button format with choices: Year, Month, Day, Hour, Minute, Second]

[Button: Calculate]

[Button: Close form]

Output(s):

[Label: Time difference = {#} {unit asked from Difference type}]

Optional: [Label: Time difference using DateDiff function = {#} {unit asked from Difference type}]

The only difference between your program and DateDiff is that in your program you have to deal with input where Time 1 > Time 2, while DateDiff gives negative number for the result.

3. 1 year = 366 days in leap year, otherwise 365 days. Inputs are limited between 2001/01/01 00:00:00 to 2999/12/31 23:59:59

4. Use the functions to determine leap year and determine days passed within a year in previous assignments to calculate the total days between the two dates.

5. Program should be written based on the materials that have been covered in the class: See below;

 Coding/Matlab/Visual Basic Input/Output input, fprintf, disp, load, save InputBox, Msgbox Branching if-elseif-else, case If-ElseIf-Else, Case, Goto Looping for, while For, Do While, Do Until Function Function Function or Procedure Built-In Function String manipulation functions. EXCLUDE: Time/Date built-in functions. GUI All GUI controls and form

6. Result Check

Visual Basic: DateDiff.

Matlab: Help > date and time function.

Any Time/Date built-in functions are just to check the result of your program! NOT to be part of your program.

Hi Cody,

I could do this in Matlab. I should be able to finish it by Sunday, but let me know if it's due later. Hope you could add \$50 as bonus, as this is bigger project.

Thanks
Customer: replied 3 years ago.

Well, if you can get it to me Tuesday would be great. Can you do both visual basic and matlab?

Ok, I'll send it before Tuesday. I can do them in both VB 2010 and Matlab, but that would be lots of work. If you're fine with adding \$120 as bonus, I'd do them in both languages.
Customer: replied 3 years ago.

Ok, thats not a problem.

Alright then. I'll send both programs to you by Tuesday. I hope you already have Microsoft Visual Basic 2010 and Matlab on your system.
Customer: replied 3 years ago.

I do.

You need to spend \$3 to view this post. Add Funds to your account and buy credits.
Hi there,

Were you able to retrieve the files?

Thanks
Customer: replied 3 years ago.

I will look it over today. Ive been a little busy lately. I will let you know how it works for me later today.

Ok, I'd look forward. I hope we could wrap it up by today itself, as it's end of the month :)

Thanks
Customer: replied 3 years ago.

The matlab program works great!

How do i get the excel program to work?Do i need to save all of the files in the excel vb folder?

Customer: replied 3 years ago.

Now what do i need to do to get it to run? Tell me step by step please.

Install visual basic, extract the visual basic project folder I sent, and open file daysPassed.sln. Once opened, press F5 to run the project.
Customer: replied 3 years ago.

Ok, thank you for your help. The programs run fine now. I will be looking over the actual programming in more detail over the next day or so and if i have any questions ill be sure to ask you.

Thanks

You're most welcome!