Question

My 3 friends would like to purchase a 40' sailboat and then sail to Mexico and...

My 3 friends would like to purchase a 40' sailboat and then sail to Mexico and hang out in San Carlos for one year. Please calculate and display the cost of purchase and preparation for one year of travel.

Initial costs for sailboat:

Sailboat: $20,000.00

Sales Tax: =price of boat X .0775

Registration: 45.55

Insurance: =price of boat X .01 + 566.88

Preparation for trip:

Haul and paint bottom: = length of boat X 45

New head sail: 2,300.00

Life raft: 3,800.00

Food Provisioning = number of friends X 1250

Diesel: 760.00

Medical Kit: 666.80

----------------------------

Write a program that does the following:

1. Declare a variable for each cost and assign the appropriate value or an expression to calculate the value.

2. Declare a variable for total initial-cost-of-sailboat and assign it an expression that sums up all the initial costs.

3. Declare a variable for total preparation-costs and assign it an expression that sums up all the preparation costs.

4. Declare a variable for total costs and assign it an expression that sums up initial and total costs.

4. Display all the separate costs, the two partial costs and the total. You must use the variables in the output lines, not just type in the numbers.

Programming Notes:

1. Make sure to use the proper data type for each variable.

2. Make the display look neat and professional. Label each expense. (Don't worry about rounding off the numbers to two decimal places. We will cover that in the next chapter.)

3.  Remember to use good programming style - have a header that explains - use comments - use white space to make it all readable.  

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE:

#include<stdio.h>
int main()
{  
   //Declaring variables
   int No_Of_Friends=3,Length_Of_SailBoat=40;
   double Cost_of_Sailboat,Sales_Tax,Registration_Cost;
   double Insurance,Haul_And_paint_Bottom_Cost,New_Head_Sail,Life_raft,Food_Cost,Diesel_Cost;
   double Medical_kit_cost;
   //Initial cost for sailboat:
   //Assigning given input to the variables
   Cost_of_Sailboat=20000.00;                
   Sales_Tax=Cost_of_Sailboat*0.0775;           
   Registration_Cost=45.55;
   Insurance=(Cost_of_Sailboat*0.01)+566.88;
  
   double total_initial_cost_of_sailboat;                    //variable for calculating total initial cost
   total_initial_cost_of_sailboat=Cost_of_Sailboat+Sales_Tax+Registration_Cost+Insurance;
   printf("Initial Costs Of the Sailboat:\n");
   printf("-------------------------------------------\n");
   printf("Cost of Sailboat                 : %lf\n",Cost_of_Sailboat);
   printf("Sales Tax                        : %lf\n",Sales_Tax);
   printf("Registration Cost                : %lf\n",Registration_Cost);
   printf("Insurance                        : %lf\n",Insurance);
   printf("-------------------------------------------\n");
   printf("\nTotal Initial Cost of Sailboat : %lf\n",total_initial_cost_of_sailboat);
   printf("--------------------------------------------\n\n\n");
   //preparation costs:
   //Assigning given input to the variables
   Haul_And_paint_Bottom_Cost=Length_Of_SailBoat*45;
   New_Head_Sail=2300.00;
   Life_raft=3800.00;
   Food_Cost=No_Of_Friends*1250;
   Diesel_Cost=760.00;
   Medical_kit_cost=666.80;
   double total_Preparation_cost_of_sailboat;          //variable for calculating total preparation cost
   total_Preparation_cost_of_sailboat=Haul_And_paint_Bottom_Cost+New_Head_Sail+Life_raft+Food_Cost+Diesel_Cost+Medical_kit_cost;
   printf("Preparation Costs of Sailboat:\n");
   printf("-------------------------------------------------\n");
   printf("Haul and paint bottom cost           : %lf\n",Haul_And_paint_Bottom_Cost);
   printf("New Head Sail Cost                   : %lf\n",New_Head_Sail);
   printf("Life raft Cost                       : %lf\n",Life_raft);
   printf("Food Provisoning Cost                : %lf\n",Food_Cost);
   printf("Diesel Cost                          : %lf\n",Diesel_Cost);
   printf("Medical Cost                         : %lf\n",Medical_kit_cost);
   printf("--------------------------------------------------\n");
   printf("\nTotal Preparation Cost of Sailboat : %lf\n",total_Preparation_cost_of_sailboat);
   printf("--------------------------------------------------\n\n\n");
  
   double Total_Cost;                  //variable for storing Total Cost of the sailboat
   Total_Cost=total_initial_cost_of_sailboat+total_Preparation_cost_of_sailboat;
   printf("Total_Cost: %lf",Total_Cost);                       //printing total cost
  
  
}

CODE SCREENSHOT:

OUTPUT:

Add a comment
Know the answer?
Add Answer to:
My 3 friends would like to purchase a 40' sailboat and then sail to Mexico and...
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
  • I need help writing my main method**** Computer Science 111 Introduction to Algorithms and Programming: Java...

    I need help writing my main method**** Computer Science 111 Introduction to Algorithms and Programming: Java Programming Project #4 – Classes and Objects (20 Points) You will create 3 new classes for this project, two will be chosen from the list below and one will be an entirely new class you invent.Here is the list: Shirt Shoe Wine Book Song Bicycle VideoGame Plant Car FootBall Boat Computer WebSite Movie Beer Pants TVShow MotorCycle Design First Create three (3) UML diagrams...

  • Project 4: Month-end Sales Report with array and validation Input dialog box for initial user prompt...

    Project 4: Month-end Sales Report with array and validation Input dialog box for initial user prompt with good data and after invalid data Input OK Cancel Input dialog boxes with sample input for Property 1 Ingut X Input Enter the address for Property 1 Enter the value of Property 1: OK Cancel Input dialog boxes after invalid data entered for Property 1 Error Please enter anmumber greater than D Ester the walue of Peoperty t Console output END SALES REPORT...

  • Consider a $5,000 payment that is to be received exactly three (3) years from now. If...

    Consider a $5,000 payment that is to be received exactly three (3) years from now. If the discount rate is 5%, what is the “present value” of the future $5,000 payment? Group of answer choices a. $4,319.19 b. $4,750.00 c. $4,761.90 d. $5,788.13 A pharmaceutical firm has recently developed a new medication, and is now considering whether or not to market the new medication over the next two years. The firm has decided to use “cost-benefit analysis” to make its...

  • If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but...

    If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but minor discrepancies may require you to adjust. If you are attempting this assignment using another version of Visual Studio, you can expect differences in the look, feel, and/or step-by-step instructions below and you’ll have to determine the equivalent actions or operations for your version on your own. INTRODUCTION: In this assignment, you will develop some of the logic for, and then work with, the...

  • C++ Programming

    PROGRAM DESCRIPTIONIn this project, you have to write a C++ program to keep track of grades of students using structures and files.You are provided a data file named student.dat. Open the file to view it. Keep a backup of this file all the time since you will be editing this file in the program and may lose the content.The file has multiple rows—each row represents a student. The data items are in order: last name, first name including any middle...

  • For this project, each part will be in its oun matlab script. You will be uploading a total 3 m f...

    For this project, each part will be in its oun matlab script. You will be uploading a total 3 m files. Be sure to make your variable names descriptive, and add comments regularly to describe what your code is doing and hou your code aligns with the assignment 1 Iterative Methods: Conjugate Gradient In most software applications, row reduction is rarely used to solve a linear system Ar-b instead, an iterative algorithm like the one presented below is used. 1.1...

  • please disregard the excel question А B D Question 1 -- Stacy's Travel Agency 2 3...

    please disregard the excel question А B D Question 1 -- Stacy's Travel Agency 2 3 8 Instructions 4. You are an agent at a local travel agency. Your manager has asked you to track your sales of next winter's holiday packages. For each package, customers can schoose whether or not to include a flight in the package. For each sale, an initial down payment of 20% of the total package cost is required. 6 Customers can pay the remainder...

  • Programming Language: JAVA Construct a program that uses an agent to solve a Sudoku puzzle as...

    Programming Language: JAVA Construct a program that uses an agent to solve a Sudoku puzzle as a Constraint Satisfaction Problem, with the following guidelines: 1. Since 3 x 3 puzzles are too trivial for a computer, your program should use 4 x 4 puzzles (also known as Super Sudoku puzzles; see Figure 2 for an example). 2. The program should read a Sudoku puzzle from a text file. The user should be able to browse the file system to select...

  • Business Law: Text and Cases 14th Edition Please answer Number 3 I already have questions 1...

    Business Law: Text and Cases 14th Edition Please answer Number 3 I already have questions 1 and 2 answered. 1)   Assume you are the attorney for the Landlord. List the legal grounds under which you would sue the Tenants and list the arguments you would use to persuade the Judge to rule in your favor. Also list the defenses you would raise to the counterclaim brought by Tenants. Support your answers with legal reasoning and conclusions. The lease was for...

  • Case 3: Recruiting CASE THREE: RECRUITING Case Objectives Recruiting is the first stage in which ...

    Case 3: Recruiting CASE THREE: RECRUITING Case Objectives Recruiting is the first stage in which organizational plans for staffing come into contact with the labor market for employees. Before making any new recruiting effort, an organization needs to carefully consider the methods available and balance out the costs of each method with the organization’s needs. The recruiting case provides an opportunity to see how staffing managers develop plans for recruiting efforts. You will develop a recruiting strategy and a recruiting...

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