Main should Ask a user to enter a spot and then a strike (using cin) and then pr
ID: 3784367 • Letter: M
Question
Main should Ask a user to enter a spot and then a strike (using cin) and then print out both the call and the put exercise value for the specified spots and strikes (using cout). The input should be doubles. Run a for loop that sets spots from 100 to 200 and prints out the call and put exercise values for a strike of 150 Run a for loop that sets strikes from 100 to 200 and prints out the call and put exercise values for a spot of 150 Use if statements to perform conditional execution: Ask a user to enter 0 or 1. If the user enters 0, then ask the user for a strike price and print the exercise value of a put with spot price $50. If the user enters 1, then ask the user for a spot price and print the exercise value for a call option with strike price $100. If the user enters something else, print out an error.Explanation / Answer
#include<iostream>
#include<iomanip>
#include<string>
#include <fstream>
using namespace std;
const int arraySize = 1000;
double price[arraySize];
int partNo[arraySize], quantity[arraySize];
string make[arraySize], partName[arraySize];
void menu();
void option(int);
void choice1();
int main()
{
int choice=0;
while (choice != 8)// condtion choice not equal 8
{
menu();//calling menu function
cin >> choice;// enter the choice
option (choice);// calling the switch funtion and send the choice
}
return 0;
}
void menu()// menu function the have the menu output only
{
cout <<"Inventory Control System "
<< " [1] Add part "
<< " [2] Update part "
<< " [3] Remove part "
<< " [4] List inventory "
<< " [5] Parts whose quantity < 5 "
<< " [6] Parts above a given price "
<< " [7] Parts above the average price "
<< " [8] Stock statistics "
<< " [9] Exit "
<< "Enter your choice: ";
}
void option(int x)
{
switch(x)
{
case 1 :
choice1();
break;
case 2 :
choice2();
break;
case 3 :
choice3();
break;
case 4 :
choice4();
break;
case 5 :
choice5();
break;
case 6 :
choice6();
break;
case 7 :
choice7();
break;
case 8 :
choice8();
break;
case 9 :
choice9();
break;
default :
cout<<"Wrong choice ";// if the choice were wrong
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.