Question
i need the answe clear in mat lab, i need the in put and out put please
6 29. Write a program in a script file that calculates the cost of renting a according to the following price schedule: 217 S
0 0
Add a comment Improve this question Transcribed image text
Answer #1

code

solution

%matlab code %main.m r_Type =Suv; car & read the number days 10 numberdays %prompt and read number of meals milesdriven 769elseif numberdays numberdays>6 && numberdays= 29 if milesdriven > (numberdays*100) extramilesdriven=milesdriven- (numberdays11 to 6 if numberdays>1 & & numberdays <= 6 if milesdriven > (numberdays*80) extramilesdriven=milesdriven- (numberdays 80) numif milesdriven > (numberdays*120) extramilesdriven=milesdriven- (numberdays120) costrent = numberdays*64 (extramilesdriven*0.

//output

l Result Soctave -qf -no-window-system demo.m car_Type Sedan numberdays 10 milesdriven = 769 ans 1 The cost of the rent is 69l Result Soctave -qf --no-window-system demo.m car_Type SUv numberdays = 32 milesdriven 4056 The cost of the rent is 2153.84$lI Result $octave -qf -no-window-system demo.m car_Type Sedan numberdays 3 milesdriven = 511 The cost of the rent is 423.99$

//copyable code

%matlab code

%main.m

car_Type ="SUV";

% read the number days

numberdays = 10;

%prompt and read number of meals

milesdriven = 769;

%Switch case

switch(car_Type)

        case 'Sedan'        

            %Check the condition 1 to 6

            if numberdays>1 && numberdays <= 6

                if milesdriven > (numberdays*80)              

                    extramilesdriven=milesdriven-(numberdays*80);

                    cost_rent = numberdays*79 + (extramilesdriven*0.69);

              else

                    cost_rent = numberdays*79;

                end

              

            %check the condition 6 to 29        

            elseif numberdays numberdays>6 && numberdays<= 29

  

                if milesdriven > (numberdays*100)

                    extramilesdriven=milesdriven-(numberdays*100);

                  

                    cost_rent = numberdays*69 + extramilesdriven*0.59;

                else

                    cost_rent=numberdays*69;

                end      

            %greater value 29

            else

                %calculate

                if milesdriven > (numberdays*120)

                    extramilesdriven=milesdriven-(numberdays*120);

                    cost_rent = numberdays*59 + extramilesdriven*0.49;

                else

                    cost_rent = numberdays*59;

                end

             end

      

      

        case 'SUV'  

      

            % 1 to 6

            if numberdays>1 && numberdays <= 6

                if milesdriven > (numberdays*80)                  

                    extramilesdriven=milesdriven-(numberdays*80);

                    cost_rent = numberdays*84 + (extramilesdriven*0.74);

                else

                    cost_rent = numberdays*84;

                end

          

             %7 to 29 numberdays  

            elseif (numberdays>6 && numberdays<= 29)

                if milesdriven > (numberdays*100)     

                     %calculate milesdriven

                    extramilesdriven=milesdriven-(numberdays*100);

                    %cost_rent

                    cost_rent = numberdays*74 + (extramilesdriven*0.64);

                else

                   cost_rent=numberdays*74;

                end

            else

                if milesdriven > (numberdays*120)

                    extramilesdriven=milesdriven-(numberdays*120);

                    cost_rent = numberdays*64 + (extramilesdriven*0.49);

                else

                    cost_rent = numberdays*64;

                end

            end

       otherwise

            fprintf('Invalid Input\n');

    end

fprintf('The cost of the rent is %0.2f$\n', cost_rent);

Add a comment
Know the answer?
Add Answer to:
i need the answe clear in mat lab, i need the in put and out put...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The price for renting a car at a car rental company is according to the following...

    The price for renting a car at a car rental company is according to the following schedule: Write a MATLAB program in a script file that calculates the cost of renting a car based on the shown price schedule. The program must ask the user to enter the type of car (Sedan or SUV), the number of days, and the number of miles driven. The program then displays the cost (rounded to cents) for the rent in a sentence that...

  • Please help, need to code for this business assignment using c++. Business Expense Reimbursements Calculator Probl...

    Please help, need to code for this business assignment using c++. Business Expense Reimbursements Calculator Problem statement: Business trip is part of the enterprise culture. Suppose a businessperson just completed a business trip for your company. Now, you are tasked to write a program that calculates and displays the total travel expenses, allowable expenses for the trip, and the excess that must be paid by the businessperson, if any The program should prompt the user for the following . The...

  • I need help adjusting entries. I have a difficult time trying to figure out what the...

    I need help adjusting entries. I have a difficult time trying to figure out what the proper adjustments I need to make. Parts 1-8 being completed would be very much appreciated! Accounting 2140 - Comprehensive Problem No On October 1, 2019, Santana Rey launched a computer services company called Business Solutions, which provides consulting services, computer system installations, and custom program development. Rey adopts the calendar year for reporting purposes and expects to prepare the company's first set of financial...

  • please help!! please tell me if you want to look a the format of where i...

    please help!! please tell me if you want to look a the format of where i am supposed to enter the information 0 D 0 After the success of the company's first two months, Santana Rey continues to operate Business Solutions. The November 30, 2018, unadjusted trial balance of Business Solutions (reflecting its transactions for October and November of 2018) follows. No. Account Title Debit Credit 101 Cash $ 39,164 106 Accounts receivable 13,218 126 Computer supplies 2,645 128 Prepaid...

  • Analyze the case the answer the questions: introduction of the case assess the financial reporting landscape...

    Analyze the case the answer the questions: introduction of the case assess the financial reporting landscape considering the user needs, constraints, and business environment, identify the issues, analyze the issues (qualitatively and quantitatively), and provide a recommendation and conclusion. Original content only no copy-paste, please INTRODUCTION Jaden McCoy operated a dairy goat farm in Soddy-Daisy, Tennessee, and was considering expanding the rental of his goats for land clearing. In early 2011, McCoy successfully bid on a job to clear a...

  • INTRODUCTION Jaden McCoy operated a dairy goat farm in Soddy-Daisy, Tennessee, and was considering expanding the...

    INTRODUCTION Jaden McCoy operated a dairy goat farm in Soddy-Daisy, Tennessee, and was considering expanding the rental of his goats for land clearing. In early 2011, McCoy successfully bid on a job to clear a section of property at a nearby resort. McCoy's goats performed as expected and he eamed a small profit in the process. The resort manager was quite happy because the difficult-to-reach areas of the property were cleared on time and on budget at a cost well...

  • I need to create a Trial Balance from data in the first two pictures. art 1:...

    I need to create a Trial Balance from data in the first two pictures. art 1: Problem After the success achieved in ihe first two months of operations, Business Solutions continues to be nanaged by Santana Rey. The November 30, 2018, unadjusted trial balance of the company, reflecting is transactions for October and November of 2018, is shown in Figure 1. Figure 1. Unadjusted Trial Balance - November 30, 2018 Account Title Credit 101 Cash Debit $38,264 12,618 2,545 2,220...

  • I need help with these adjustment entries as I have completed the others. It would be...

    I need help with these adjustment entries as I have completed the others. It would be great if the others can be completed as well so I can check my work and other students have the opportunity as well. Thank you so much experts! Serial Problem Business Solutions LO P1, P2, P3, P4, P5 After the success of the company's first two months, Santana Rey continues to operate Business Solutions. The November 30, 2018, unadjusted trial balance of Business Solutions...

  • Hello if you could please fill out all the given parts!! 1-8 all the required parts....

    Hello if you could please fill out all the given parts!! 1-8 all the required parts. I would have immense GRATITUDE, i will do anything you ask I started it off feel free to correct me and please build on it thank you very much i will upvote even if you attempt!! Goodluck hopefully someone will help a man out. After the success of the company's first two months, Santana Rey continues to operate Business Solutions. The November 30, 2019,...

  • i need help finding #32 & statement in changes of retained earnings Byte of Accounting, Inc....

    i need help finding #32 & statement in changes of retained earnings Byte of Accounting, Inc. Description of transaction June 1: Byte of Accounting, Inc. issued 2.660 shares of its common stock to Jeremy after $29,700 in cash and computer equipment with a fair market value of $42.120 were received June 1: Byte of Accounting, Inc. issued 2.562 shares of its common stock after acquiring from Courtney $55.350 in cash, computer equipment with a fair market value of $12.960 and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT