Question

Hi I need some help on how to write this in a H file for c++...

Hi I need some help on how to write this in a H file for c++ please

You will need to create two structures. One is called Cost. Cost will have the following members:

  • The number of hours it takes to take care of a specific Dinosaur.
  • The cost (per hour) of taking care of this Dinosaur.
  • The cost of food to feed this Dinosaur for one week.
  • The cost of materials/supplies (grooming, medical) for this Dinosaur for one week

The second structure is called Dinosaurs. Dinosaurs will have the following members:

  • The name of the Dinosaur
  • The description of the Dinosaur
  • The average length of the Dinosaur (in feet)
  • The average height of the Dinosaur (in feet)
  • The location of the Dinosaur (example: its origin or where they are commonly found)
  • If the Dinosaur is dangerous (Boolean variable)
  • A variable to hold the Cost structure members
0 0
Add a comment Improve this question Transcribed image text
Answer #1

source code of the above question

/*
* File: dinosaur.h
* Author: student
*
* Created on 22 November, 2019, 2:24 PM
*/

#ifndef DINOSAUR_H
#define DINOSAUR_H
using namespace std;
//member declaration of Cost structure
struct Cost
{
int no_of_hours;
int cost_per_hour;
float cost_of_food;
float cost_of_materials;
};
//member declaration of Dinosaur structure
struct Dinosaurs
{
string name;
string description;
float length_dino;
float height_dino;
string origin_loc_dino;
bool nature;
struct Cost C;
};

#endif /* DINOSAUR_H */

implemented this header file in c++ program is given below

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

/*
* File: testprogram.cpp
* Author: student
*
* Created on 22 November, 2019, 2:41 PM
*/

#include <iostream>
#include "dinosaur.h"
using namespace std;

int main()
{
Dinosaurs D;
D.name="black dinosaur";
D.description="black,wild dinosaur found in amazon jungle";
D.length_dino=12;
D.height_dino=15.5;
D.origin_loc_dino="AMAZON";
D.nature=1;
D.C.no_of_hours=2;
D.C.cost_per_hour=500;
D.C.cost_of_food=1000;
D.C.cost_of_materials=1000;
float total_cost=D.C.no_of_hours*(D.C.cost_per_hour+D.C.cost_of_food+D.C.cost_of_materials);
cout<<"the information about a dinosaur and total cost per week spent to a dinosaur given below"<<endl;
cout<<D.name<<endl;
cout<<D.description<<endl;
cout<<D.length_dino<<"feet"<<endl;
cout<<D.height_dino<<"feet"<<endl;
cout<<"origin of dinosaur in "<<D.origin_loc_dino<<endl;
if(D.nature==1)
cout<<"dangerous dinosaur"<<endl;
else
cout<<"non dangerous dinosaur"<<endl;
cout<<"total cost spent per dinosaur in a week="<<total_cost;
return 0;
}

screen of the above program given below

result after executing the above program

Add a comment
Know the answer?
Add Answer to:
Hi I need some help on how to write this in a H file for c++...
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
  • C++ ONLY PLEASE. CAN I GET SOME HELP WRITING THIS HEADER FILE? I MAINLY WANT TO...

    C++ ONLY PLEASE. CAN I GET SOME HELP WRITING THIS HEADER FILE? I MAINLY WANT TO KNOW HOW I WOULD WRITE IT WITH A TEMPLATE. PLEASE AND THANKS IN ADVANCE. **************LinkedList.h requirements************************ linked list Class EXTRA CREDIT OPPORTUNITY: Create the LinkedList class as a template class for 5 extra credit points!!! private memebers Create a structure called ListNode, which should hold a Dinosaur and a pointer to the next ListNode ListNode pointer called head – will eventually point to the...

  • Can I get some help??? Did I complete this problem correctly? GENERAL You plan to open...

    Can I get some help??? Did I complete this problem correctly? GENERAL You plan to open a pet services business that will offer dog grooming. day care and boarding COMPANY PROFILE TAB Determine a company name. Be creative fe.q. "Inspiring Dog Care" Pick a location feq. "Chicago" Define your company's vision and mission for how your business will add value to the community COST CLASSIFICATION Accurately classify all of your costs (direct material, direct labor, manufacturing overhead, period costs) Fixed...

  • help? I am a little lost here. ITEMS TO COMPLETE FOR THIS MILESTONE (Blue Tabs): GENERAL You plan to open a pet services business that will offer dog grooming, day care and boarding COMPANY PROFIL...

    help? I am a little lost here. ITEMS TO COMPLETE FOR THIS MILESTONE (Blue Tabs): GENERAL You plan to open a pet services business that will offer dog grooming, day care and boarding COMPANY PROFILE TAB Determine a company name. B crete (e.g. "Inspiring Dog Care"] Pick a location (e.g. "Chicago") Define your company's vision and mission for how your business will add value to the community COST CLASSIFICATION Accurately classify all of your costs [direct material, direct labor, manufacturing...

  • Help please Hi, i need to write a c++ program that caculate queries by directly reading...

    Help please Hi, i need to write a c++ program that caculate queries by directly reading the content of csv files. the queries are : A) the list of all the book that were published in a given publication year (by user) B)The list of all the book of a given title that are available for borrowing C)The name of all the members who have a copy of a given title in their possession D)The name of all the members...

  • I have to find the fixed costs for GROOMER Also I have to write the answer...

    I have to find the fixed costs for GROOMER Also I have to write the answer with the Excel formula E FO Number 5 Formatting Table Styles Clipboard Font Alignment Styles Q12 . в со E F G H I J K L M мора For simplicity, base all calculations using 30 days in each month OPERATIONAL DATA Grooming: The Groomer can groom 5 dogs a day, 5 days a week Each grooming takes 1.5 labor hours Day Care: The...

  • I need a c++ visual basic program that will. Carpet Calculator. This problem starts with the...

    I need a c++ visual basic program that will. Carpet Calculator. This problem starts with the FeetInches class that is provided in the course Content area on the assignment page for this week. This program will show how classes will interact with each other as data members within another class. Modify the FeetInches class by overloading the following operators which should all return a bool. <= >= != Next add a copy constructor to the FeetInches class and a multiply...

  • 6 MILESTONE 2 (Due in Module 4) MILESTONE 3 (Due in Module 5) MILESTONE 1 (Due in Module 2) 7 9 Instructions Milestone 2 10 12 1. Contribution Margin COGM Schedule .5 Name Choose a price range and ca...

    6 MILESTONE 2 (Due in Module 4) MILESTONE 3 (Due in Module 5) MILESTONE 1 (Due in Module 2) 7 9 Instructions Milestone 2 10 12 1. Contribution Margin COGM Schedule .5 Name Choose a price range and calculate Grooming Create a Cost of Goods Manufactured Sched Location Vision Day Care Mission Bcarding 2. 2. 2. Break-Even Analysis Identify the following Create an Income Statement Calculate the break-even units Revenue will be provided end of week 4 Direct Materials Grooming...

  • Overview: In the first milestone of your final project, you will determine and classify the costs necessary for opening your business. This is a critical step that must be done correctly for you to s...

    Overview: In the first milestone of your final project, you will determine and classify the costs necessary for opening your business. This is a critical step that must be done correctly for you to successfully complete the subsequent milestones and the final submission. Scenario: Prior to Opening, Part I: You plan to open a pet-services business that will offer dog grooming, day care, and boarding. You can be creative in deciding the name of your business (e.g., "Inspiring Dog Care"),...

  • I need this to be in C Write the implementation file, priority queue.c, for the interface...

    I need this to be in C Write the implementation file, priority queue.c, for the interface in the given header file, priority queue.h. Turn in your priority queue.c file and a suitable main program, main.c, that tests the opaque object. priority queue.h is attached as a file to this assignment but is also listed here for your convenience. Your implementation file should implement the priority queue using a heap data structure. Submissions that implement the priority queue without using a...

  • please help with the income statement - + Fit to page D Page view A Read...

    please help with the income statement - + Fit to page D Page view A Read aloud h Add notes Overview: In the third milestone, you will jump forward in time: Imagine that your business has already opened. Use the updated scenario information to analyze your company's performance. o Post-opening Scenario: Your angel investors are silent in relation to the business; however, they require board meetings for status updates on the company's financial health. Therefore, you need to analyze your...

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