Ask a question to Desklib · AI bot

Ask NowBETA

C# Console Application Assignment

4 Pages738 Words465 Views
   

Added on  2019-10-12

BookmarkShareRelated Documents
// ConsoleApplication13.cpp : Defines the entry point for the console application.#include"stdafx.h"#include<iostream>#include<string>// Function Prototypesvoid getNum(int &num);void getDescription(std::string & desc);void getHoursWorked(double & hrs);void getWeightOfSilver(double & silver_wt);void getWeightOfGold(double & gold_wt);void getPriceOfGem(double & price_gem);double getWholeSalePrice(doublehrs, doublesilver_wt, doublegold_wt, doubleprice_gem);int main(){int num;double price_gem, gold_wt, silver_wt, hrs;std::string desc;getNum(num);getDescription(desc);getHoursWorked(hrs);getWeightOfSilver(silver_wt);getWeightOfGold(gold_wt);getPriceOfGem(price_gem);double wholeSalePrice = getWholeSalePrice(hrs, silver_wt, gold_wt, price_gem);double retailPrice = 5 * wholeSalePrice;std::cout <<"********** Princess Jewelry Design Jewelary detail **********"<< std::endl;std::cout <<"Jewelry description :"<< desc << std::endl;std::cout <<"Silver used :"<< silver_wt <<" ounces"<< std::endl;std::cout <<"Gold used :"<< gold_wt <<" ounces"<< std::endl;std::cout <<"Gem Price :"<< price_gem <<std::endl;std::cout <<"Whole sale price :"<< wholeSalePrice <<std::endl;std::cout <<"Retail sale price :"<< retailPrice <<std::endl;
C# Console Application Assignment_1
return 0;}void getNum(int &num){while (1){std::cout <<"Enter the number ?";std::cin >>num;if (num > 0){break;}else{std::cout <<"Invalid value entered, please try again"<< std::endl;}}}void getDescription(std::string & desc){std::cout <<"Enter the description ? ";std::cin.ignore();getline(std::cin, desc);}void getHoursWorked(double & hrs){while (1){std::cout <<"Enter the number hrs worked? ";std::cin >>hrs;if (hrs > 0.0){break;}else{std::cout <<"Invalid value entered, please try again"<< std::endl;}
C# Console Application Assignment_2

Found this document preview useful?

Related Documents
Error Checking And Handling
|12
|2453
|21