Question: Need help with problem 3 . Answer the following problems into a single Live Script file. Make each of the problems below a single cell.

Need help with problem 3.
Answer the following problems into a single Live Script file. Make each of the problems below a single cell.
1
2
(5 points) At a local university, each engineering major requires a different number of credits for graduation. For example, recently the requirements were as follows:
\table[[Civil Engineering,130],[Chemical Engineering,130],[Computer Engineering,122],[Electrical Engineering,126.5],[Mechanical Engineering,129]]
Prompt the user to select an engineering program from a menu. You must use the menu command. Do some research on how to use this command in Matlab.
Use a switch/case structure to send the minimum number of credits required for graduation back to the command window.
(10 points) Edmond Halley (the astronomer famous for discovering Halley's comet) invented a fast algorithm for computing the square root of a number, A. Halley's algorithm approximates ?2A as follows: Start with an initial guess x1. The new approximation is then given by
Yn=1Axn2
xn+1=xn8(15-yn(10-3yn))
These two calculations are repeated until some convergence criterion, , is met.
|xn+1-xn|
Using for loop and break statements, write a code that approximates the square root of 5.
Complete five iterations and display results after each iteration and the value of .
Compare the last iteration result to the true value found using the sqrt command. Display results up to ten decimal places to see the actual differences in values.
Use tic and toc commands to time the operation.
3(5 points) A store owner asks you to write a program using the while loop for use in the checkout process.
The program should:
Prompt the user to enter the cost of the first item.
Continue to prompt for additional items, until the user enters 0.
Display the total.
Prompt for the dollar amount the customer submits as payment.
Display the change due.
Sample solution:
You'll need 126.5 credits to graduate
After five iteration x=2.2360679775
True value 2.2360679775
Elapsed time is 0.023951 seconds.
cost=25.5900
cost=3.6400
cost=12.5000
cost=0
Your total is $41.73
Your change is $ 58.27
Need help with problem 3 . Answer the following

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!