Question

I need this coded in C++. I keep coming up with errors. // Start // Declarations...

I need this coded in C++. I keep coming up with errors.

// Start
// Declarations
// number id
// string ownerName
// string breed
// number age
// number weight
// number weeklyFee
//
// output "Please enter owner's ID: "
// input id
// output "Please enter owner's name: "
// input ownerName
// output "Please enter dog's breed (no space in input, use '_'
// instead; For example Great_Dane): "
// input breed
// output "Please enter dog's age: "
// input age
// output "Please enter dog's weight: "
// input weight
// if (weight < 15) then
// weeklyFee = 55.00
// else if ((weight >= 15) and (weight <= 30)) then
// weeklyFee = 75.00
// else if ((weight > 30) and (weight <= 80)) then
// weeklyFee = 105.00
// else
// weeklyFee = 125.00
//
// output "Owner Name: ", ownerName
// output "Owner ID: ", id
// output "Dog Breed: ", breed
// output "Dog Age: ", age
// output "Dog Weight: ", weight
// output "Weekly Fee: ", "$",weeklyFee
// Stop

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

#include<iostream>
using namespace std;
int main(){
   int id;
   string ownerName;
   string breed;
   int age;
   int weight;
   int weeklyFee;
   cout<<"Please enter owner's ID: ";
   cin>>id;
   cout<<"Please enter owner's nane: ";
   cin>>ownerName;
   cout<<"Please enter dog's breed (no space in input, use '_' instead;For example Great_Dane): ";
   cin>>breed;
   cout<<"Please enter dog's age: ";
   cin>>age;
   cout<<"Please enter dog's weight: ";
   cin>>weight;
   if(weight < 15){
       weeklyFee = 55.00;
   }else if((weight >= 15) && (weight<=30)){
       weeklyFee = 75.00;
   }else if((weight > 30) && (weight <= 80)){
       weeklyFee = 105.00;
   }else{
       weeklyFee = 125.00;
   }
  
   cout<<"Owner Name: "<<ownerName<<endl;
   cout<<"Owner ID: "<<id<<endl;
   cout<<"Dog Breed: "<<breed<<endl;
   cout<<"Dog Age: "<<age<<endl;
   cout<<"Dog Weight: "<<weight<<endl;
   cout<<"Weekly Fee: "<<"$"<<weeklyFee;
}

/* Output */

Please enter owner's ID: 123
Please enter owner's nane: xyz
Please enter dog's breed (no space in input, use '_' instead;For example Great_Dane): Great_Dane
Please enter dog's age: 5
Please enter dog's weight: 20
Owner Name: xyz
Owner ID: 123
Dog Breed: Great_Dane
Dog Age: 5
Dog Weight: 20
Weekly Fee: $75

/* Please upvote (thank you in advance)*/

Add a comment
Know the answer?
Add Answer to:
I need this coded in C++. I keep coming up with errors. // Start // Declarations...
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
  • solve it in c++ 10 note: please do not give me same answer like this 1....

    solve it in c++ 10 note: please do not give me same answer like this 1. Define a Pet class that stores the pet's name, age, and weight. Add appropriate constructors, accessor functions, and mutator functions. Also define a function named getLifespan that returns a string with the value "unknown lifespan." Next, define a Dog class that is derived from Pet. The Dog class should have a private member variable named breed that stores the breed of the dog. Add...

  • In Java Code Needed is Below the Question Using Program 3: Encapsulating Dogs, modify this program...

    In Java Code Needed is Below the Question Using Program 3: Encapsulating Dogs, modify this program to create a database of dogs of your own. You will also include File I/O with this program. You will create 3 classes for this assignment. The first class: Create a Class representing the information that is associated with one item (one dog) of your database. Name this class Dog. Using Lab 3, this will include the information in regard to one dog. The...

  • Hello I need a small fix in my program. I need to display the youngest student...

    Hello I need a small fix in my program. I need to display the youngest student and the average age of all of the students. It is not working Thanks. #include <iostream> #include <iomanip> #include <fstream> #include <vector> #include <algorithm> using namespace std; struct Student { string firstName; char middleName; string lastName; char collegeCode; int locCode; int seqCode; int age; }; struct sort_by_age { inline bool operator() (const Student& s1, const Student& s2) { return (s1.age < s2.age); // sort...

  • I NEED UML FOR THIS QUESTION ONLY! This question 9 requires you to (i) draw a...

    I NEED UML FOR THIS QUESTION ONLY! This question 9 requires you to (i) draw a UML diagram and (ii) address 9(a) to 9(e) questions. • Draw a UML diagram (in the style covered in week 7) to represent the data entities model of all custom data types in the given program. You are required to paste your UML diagram to On Track 9.2P resource document for 9.2P submission. Your assessor will evaluate your work. • Analyse the information of...

  • I need to now how to input the following code into the complier for C++ code....

    I need to now how to input the following code into the complier for C++ code. It is for chapter 8 question 7a in the PLD book // Start //     Declarations //         num MAXADS = 100 //         num adcatcode[MAXADS] //         num adwords[MAXADS] //         num curCode //         num numads //         num i //         num j //         num k //         num subtotal //         num temp //     output "Please enter the number of ads: " //     input numads //     if ((numads > 0)...

  • Hello, I need to implement these small things in my C++ code. Thanks. 1- 10 characters...

    Hello, I need to implement these small things in my C++ code. Thanks. 1- 10 characters student first name, 10 characters middle name, 20 characters last name, 9 characters student ID, 3 characters age, in years (3 digits) 2- Open the input file. Check for successful open. If the open failed, display an error message and return with value 1. 3- Use a pointer array to manage all the created student variables.Assume that there will not be more than 99...

  • Please help fix my code C++, I get 2 errors when running. The code should be...

    Please help fix my code C++, I get 2 errors when running. The code should be able to open this file: labdata.txt Pallet PAG PAG45982IB 737 4978 OAK Container AYF AYF23409AA 737 2209 LAS Container AAA AAA89023DL 737 5932 DFW Here is my code: #include <iostream> #include <string> #include <fstream> #include <vector> #include <cstdlib> #include <iomanip> using namespace std; const int MAXLOAD737 = 46000; const int MAXLOAD767 = 116000; class Cargo { protected: string uldtype; string abbreviation; string uldid; int...

  • Write a program in java. You are tasked with writing an application that will keep track...

    Write a program in java. You are tasked with writing an application that will keep track of Insurance Policies. Create a Policy class called InsurancePolicies.java that will model an insurance policy for a single person. Use the following guidelines to create the Policy class: • An insurance policy has the following attributes: o Policy Number o Provider Name o Policyholder’s First Name o Policyholder’s Last Name o Policyholder’s Age o Policyholder’s Smoking Status (will be “smoker” or “non-smoker”) o Policyholder’s...

  • Hello in C#. I need help understanding and knwoing what i missed in my program. The...

    Hello in C#. I need help understanding and knwoing what i missed in my program. The issue is, the program is supposed to have user input for 12 family members and at the end of the 12 it asks for user to input a name to search for. When i put a correct name, it always gives me a relative not found message. WHat did i miss. And can you adjust the new code so im able to see where...

  • Input hello, I need help completing my assignment for java,Use the following test data for input...

    Input hello, I need help completing my assignment for java,Use the following test data for input and fill in missing code, and please screenshot output. 1, John Adam, 3, 93, 91, 100, Letter 2, Raymond Woo, 3, 65, 68, 63, Letter 3, Rick Smith, 3, 50, 58, 53, Letter 4, Ray Bartlett, 3, 62, 64, 69, Letter 5, Mary Russell, 3, 93, 90, 98, Letter 6, Andy Wong, 3, 89,88,84, Letter 7, Jay Russell, 3, 71,73,78, Letter 8, Jimmie Wong,...

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