C# Console Application Assignment

Added on - 12 Oct 2019

  • 4

    pages

  • 738

    words

  • 63

    views

  • 0

    downloads

Showing pages 1 to 2 of 4 pages
// ConsoleApplication13.cpp : Defines the entry point for theconsole application.#include"stdafx.h"#include<iostream>#include<string>// Function PrototypesvoidgetNum(int&num);voidgetDescription(std::string&desc);voidgetHoursWorked(double&hrs);voidgetWeightOfSilver(double&silver_wt);voidgetWeightOfGold(double&gold_wt);voidgetPriceOfGem(double&price_gem);doublegetWholeSalePrice(doublehrs,doublesilver_wt,doublegold_wt,doubleprice_gem);intmain(){intnum;doubleprice_gem, gold_wt, silver_wt, hrs;std::stringdesc;getNum(num);getDescription(desc);getHoursWorked(hrs);getWeightOfSilver(silver_wt);getWeightOfGold(gold_wt);getPriceOfGem(price_gem);doublewholeSalePrice = getWholeSalePrice(hrs, silver_wt,gold_wt, price_gem);doubleretailPrice = 5 * wholeSalePrice;std::cout<<"********** Princess Jewelry Design Jewelarydetail **********"<<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;
return0;}voidgetNum(int&num){while(1){std::cout<<"Enter the number ?";std::cin>>num;if(num> 0){break;}else{std::cout<<"Invalid value entered, please tryagain"<<std::endl;}}}voidgetDescription(std::string&desc){std::cout<<"Enter the description ? ";std::cin.ignore();getline(std::cin,desc);}voidgetHoursWorked(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 tryagain"<<std::endl;}
desklib-logo
You’re reading a preview
card-image

To View Complete Document

Become a Desklib Library Member.
Subscribe to our plans

Unlock This Document