[solved] – Question 95778

Write a program to calculate students’ average test scores and their grades. You may assume the following input data:
Tau 85 83 77 91 76
Thabo 80 90 95 93 48
Gupta 78 81 11 90 73
Jabu 92 83 30 69 87
Baloyi 23 45 96 38 59
Njomane 60 85 45 39 67
Menzi 77 31 52 74 83
Chisedzi 93 94 89 77 97
Masilela 79 85 28 93 82
Sibanda 85 72 49 75 63
Use two-dimensional array to store the test scores, and a parallel one-dimensional array to store grades. Your program must contain at least the following functions: a function to read and store data into arrays, a function to calculate the average test score and grade, and a function to output the results. Have your program also output the class average

Expert Answer


[solved] – Question 95794

Write a program that accepts a time as an hour and minute. Add 15 minutes to the time, and output the result.

Example 1:

Enter the hour: 8
Enter the minute: 15
It displays:

Hours: 8
Minutes: 30
Example 2:

Enter the hour: 9
Enter the minute: 46
It displays:

Hours: 10
Minutes: 1

Expert Answer


[solved] – Question 95808

Consider the parabola defined by y = x
2 − 2x − 1. The distance d(x) from the origin
(0, 0) to a point (x, y) on the parabola is given by
d(x) = q
x
2 + (x
2 − 2x − 1)
2
.
(a) Write a MATLAB program and function M-file to plot d(x) for −2 ≤ x ≤ 4. Also use the
function M-file and the fminbnd command to find (and display) the point (xmin,ymin) on
the parabola that is closest to the origin and display the minimum distance (i.e., the distance
from the origin to the point (xmin,ymin)).
(b) Write a MATLAB program using the fzero command to find the point(s) on the parabola at
distance 4 from the origin.

Expert Answer


[solved] – Question 95809

Consider the function f(x) = e
x where e = 2.718 . . . is the base of the natural logarithm
(ln = loge
), sometimes known as Napier’s constant. For x close to 0, e
x
can be approximated by a
finite Taylor series:
e
x ≈ s = 1 + x +
x
2
2! +
x
3
3! +
x
4
4! + · · · +
x
p
p!
where p is a positive integer.
(a) Write a MATLAB program with a for loop to compute (and display) the approximation s of
e
x and the difference d = s − e
x
for p = 1, 2, . . . , num where x and num are entered by the user.
Your program should use format long e and display the values s and d in two columns
with appropriate headings. (Recall that e
x
can be computed in MATLAB using exp(x).)
(b) Run your program with x = 0.5 and num = 10.
(c) Use your program to find the smallest value of p for which the difference s − e
0.5 is less than
10−14 in absolute value.

Expert Answer


[solved] – Question 95818

Test if a number grade is an A (greater than or equal to 90). If so print “Great!”.

Expert Answer


[solved] – Question 95886

Write a program Checkers that takes one number (X) entered by the user and prints out a two dimensional X-by-X checkerboard pattern with alternating spaces and asterisks, like the following 4-by-4 pattern. Remember, the user should be able to enter any value for X and the output should be an X-by-X checkerboard of alternating spaces and asterisks.

* * * *

* * * *

* * * *

* * * *

Expert Answer


[solved] – Question 95887

Test if a password entered is correct. The secret phrase is Ada Lovelace.

Examples:

Enter the Password: Ada Lovelace

Correct!
Enter the Password: Blaise Pascal

Not Correct

Expert Answer


[solved] – Question 95888

Test if a number grade is an A (greater than or equal to 90). If so print “Great!”.

Expert Answer


[solved] – Question 95892

write a cash register program that calculates change for a restaurant of your choice. Your program should include:

Expert Answer


[solved] – Question 95902

provide

(a) an algorithm
(b) flowchart
(c) pseudocode

(1) illustrate the assignment from 10 to x
If x<y otherwise 5 Is assigned to x
(2) compute the sum of the series ;
f(x) = 1+x+x^2+x^3+………..+x^n

Expert Answer