1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mr Goodwill [35]
3 years ago
10

Program: assign03a.m Write a MATLAB script file that uses principal (or amount), rate of interest, and time to compute and displ

ay the simple interest with appropriate labeling. Create a vector of rates using the following information entered from user. Ask the user to enter the low and high values for the rate range and the number of rates. Ask the user for the number of years.

Mathematics
1 answer:
DochEvi [55]3 years ago
4 0

Answer:

The code is given in the answer along with the algorithm and explanation. The output and the workspace variables are also attached as screen shots.

Step-by-step explanation:

The basic algorithm of the code is as follows:

  1. Clear the workspace, command window and prepare the format as banking.
  2. Set the constant value of principal amount, this is fixed as 4000 in the code and can be changed.
  3. Ask the user to enter the value of lowest interest rate , highest interest rate , number of interest rate  values and number of years.
  4. Create the interest rate vector.
  5. For each entry of the interest rate vector, calculate the interest.
  6. Display the each entry of interest rate and the simple calculated interest.
  7. Calculate the average rate of interest and the average interest and display them.

The code is here as follows

%% Preparing the formats

clc,clear all;%Clearing command line and workspace

format bank%Formatting

format compact%Formatting

%% Setting the constants

PRINCIPAL = 4000;%Principal amount fixed as 4000.

%% Taking inputs from the user

low_val = input('Enter the low value for the rate range: ');%Lowest value of the interest

high_val = input('Enter the high value for the rate range: ');%Highest value of the interest

rate_vals = input('Enter the number of rate values including high and low values: '); %Total number of rate values

year = input('Enter number of years: ');% Number of years

%% Creating the interest vectors

rate = linspace(low_val,high_val,rate_vals);%Creating the vector

%% Initializing the array

simple_interest=zeros(length(rate),1);%initializing the array to hold the simple interest

%% Displaying the interest rate vectors

fprintf('\t\t Rate(%%)\t\tInterest($)\n');%Displaying the  interest rate and interest heading

%% Calculating the interest vectors

for i = 1:length(rate)

   simple_interest(i) = (rate(i)*year*PRINCIPAL)/100;%Calculating Simple rate of interest for a given rate over the principal amount

fprintf('\t\t %.2f\t\t\t%.2f\n',rate(i),simple_interest(i));% Displaying each entry  interest rate and interest

end

%% Calculating and printing the average interest

fprintf('Average: Rate(%%)\t\tInterest($)\n');%Displaying the heading for average rate and interest

fprintf('\t\t %.2f\t\t\t%.2f\n',mean(rate),mean(simple_interest));%Calculating and displaying the average interest.

You might be interested in
At a shelter, 15% of dogs are puppies. There are 60 dogs at the shelter.How many are puppies?
Ostrovityanka [42]
It is important to look at all the information’s already given in the question. Those information’s will come in handy while solving the question.
Number of dogs in the shelter = 60
Percentage of puppies in the shelter = 15%
Then
Number of puppies in the shelter = (15/100) * 60
                                                     = 900/100
                                                     = 9
So there are a total of 9 puppies in the shelter. I hope the procedure is clear enough for you to understand. I am glad to have helped you.


7 0
3 years ago
Read 2 more answers
4x4 + 32x - 28 = 0<br> whats the answer to this
Stells [14]

Answer:

0

Step-by-step explanation:

4x4 + 32x - 28 = 0

5 0
3 years ago
Read 2 more answers
A triangle with vertices A(0,0), B(6,0), and C(0,9) is rotated 360 about the y-axis. What is the volume of the figure?
Luden [163]

Given:

A triangle with vertices A(0,0), B(6,0), and C(0,9) is rotated 360 about the y-axis.

To find:

The volume of the figure.

Solution:

Points A(0,0) and C(0,9) lies on the y-axis. Length of AC is 9 units.

Points A(0,0) and B(6,0) lies on the x-axis. Length of AB is 6 units.

If a triangle with vertices A(0,0), B(6,0), and C(0,9) is rotated 360 about the y-axis, then it will form a cone with radius 6 units and height 9 units.

Volume of a cone is

V=\dfrac{1}{3}\pi r^2h

where, r is radius of the base and h is vertical height of the cone.

Putting r=6 and h=9, we get

V=\dfrac{1}{3}\pi (6)^2(9)

V=\pi (36)(3)

V=108\pi

Therefore, the volume of the figure is 108\pi sq. units.

7 0
3 years ago
Question 1. If the perimeter of Rectangle ABCD is 34y+2. What is the width?
Savatey [412]

Answer:

Question 1. If the perimeter of Rectangle ABCD is 34y+2. What is the width?

Question 2. What is the area of Rectangle ABCD in terms of y?

Question 3. If the perimeter of the rectangle is 70. What is it’s area?

Question 4. What are the length and width of the rectangle?

6 0
3 years ago
Working alone, it takes Julia 16 hours to clean an attic. Lea can clean the same attic in 15 hours. If they worked together how
egoroff_w [7]
How do you think we set this problem up?

7 0
3 years ago
Other questions:
  • PLEASEE HEELPPP I NEED THIS QUESTION ANYONE HELP!!!
    11·1 answer
  • Answers to questions 15,19,20,21 &amp;25
    7·1 answer
  • Which statement compares the median wind speeds for the data in the two box plots? The median wind speed for country A is greate
    7·2 answers
  • A cone and it’s dimensions are shown in the diagram. What is the volume of the cone in cubic inches?
    7·1 answer
  • In Exercises 15 and 16, tell whether the triangle with the given side
    9·1 answer
  • Evaluate −x+4y when x=−4/5 and y=1/3. Write your answer as a fraction or mixed number in simplest form.
    7·2 answers
  • The linear equatic
    11·1 answer
  • Estimate the circumference of a circle that has a radius of 11 m.
    11·1 answer
  • Solve the equation by completing the square.<br><br> g^2+3g=340
    14·1 answer
  • A local flower shop advertises that 4 out of every 5 flower seeds will grow. If Janie plants 40 of these flower seeds in her gar
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!