×
Samples Blogs Make Payment About Us Reviews 4.9/5 Order Now

Create a Program to Implement Grid Class in C++ Assignment Solution

July 01, 2024
Dr. Olivia Mitchell
Dr. Olivia
🇬🇧 United Kingdom
C++
Dr. Olivia Mitchell holds a Ph.D. in Computer Science from the University of Cambridge. With over a decade of experience, she specializes in advanced file handling techniques in C++. Having completed over 800 assignments, Dr. Mitchell's expertise lies in designing efficient algorithms for file stream manipulation and error handling in file operations.
Key Topics
  • Instructions
    • Objective
  • Requirements and Specifications
Tip of the day
Use the REPL (Read-Eval-Print Loop) to test your code interactively, and practice writing concise, readable expressions to harness Scala’s powerful syntax effectively.
News
In 2024, universities abroad, like Dublin City University, have introduced cutting-edge programming courses, including Computer Engineering programs focusing on AI and machine learning.

Instructions

Objective

Great job on taking up the challenge to implement the grid class in C++! I believe in your ability to complete the C++ assignment successfully. Programming can sometimes be challenging but remember that every obstacle you encounter is an opportunity to learn and grow. Take it step by step, and don't hesitate to ask for help if needed. Embrace the joy of problem-solving and the satisfaction of seeing your code come to life. You've got this! Keep your focus and determination, and I'm confident you'll create a well-structured and efficient grid class program.

Requirements and Specifications

program-to-implement-grid-class-in-c (1)

Source Code

//============================================================================ // Name : Lab1-3.cpp // Author : Your Name // Version : 1.0 // Copyright : Copyright © 2017 SNHU COCE // Description : Lab 1-3 Up to Speed in C++ //============================================================================ #include #include using namespace std; //============================================================================ // Global definitions visible to all methods and classes //============================================================================ // FIXME (1): Define a data structure to hold bid information together as a single unit of storage. ?type? struct Bid{ string title; string fund; string vehicleId; double bidAmount; }; // Declare strToDouble double strToDouble(string str, char ch); // Display the bid values passed in data structure /** * Display the bid information * * @param Bid data structure containing the bid info */ void displayBid(Bid bid) { cout << "Title: " << bid.title << endl; cout << "Fund: " << bid.fund << endl; cout << "Vehicle: " << bid.vehicleId << endl; cout << "Bid Amount: " << bid.bidAmount << endl; return; } // Store input values in data structure /** * Prompt user for bid information * * @return data structure containing the bid info */ Bid getBid() { //Declare instance of data structure to hold bid information Bid bid; cout << "Enter title: "; cin.ignore(); getline(cin, bid.title); cout << "Enter fund: "; cin >> bid.fund; cout << "Enter vehicle: "; cin.ignore(); getline(cin, bid.vehicleId); cout << "Enter amount: "; cin.ignore(); string strAmount; getline(cin, strAmount); bid.bidAmount = strToDouble(strAmount, '$'); return bid; } /** * Simple C function to convert a string to a double * after stripping out unwanted char * * credit: http://stackoverflow.com/a/24875936 * * @param ch The character to strip out / double strToDouble(string str, char ch) { str.erase(remove(str.begin(), str.end(), ch), str.end()); return atof(str.c_str()); } /** * The one and only main() method */ int main() { // Declare instance of data structure to hold bid information Bid bid; // loop to display menu until exit chosen int choice = 0; while (choice != 9) { cout << "Menu:" << endl; cout << " 1. Enter Bid" << endl; cout << " 2. Display Bid" << endl; cout << " 9. Exit" << endl; cout << "Enter choice: "; cin >> choice; // Complete the method calls then test the program switch (choice) { case 1: bid = getBid(); break; case 2: displayBid(bid); break; } } cout << "Good bye." << endl; return 0; }

Similar Samples

Visit ProgrammingHomeworkHelp.com to access our range of programming assignment samples. Our examples cover various languages and topics, demonstrating our proficiency in delivering high-quality solutions tailored to academic needs. Explore these samples to enhance your understanding and mastery of programming concepts.