You friend, Cathy has a small business and knowing that you have taken a program
ID: 3645622 • Letter: Y
Question
You friend, Cathy has a small business and knowing that you have taken a programming class wants you to create an application for her. Her company is called Cathy's Candles. Cathy's Candles offers candles in three styles - tea lights, votives and pillars. The colors available are Federal Blue, Sunflower Yellow, Christmas Red and Milky White. The scented candles have an additional charge.We will make some assumptions - the credit card information of the customer is already in file, so only the name of the customer and their customer id will be obtained for this application. Only known customers are placing orders. At this point, Cathy's Candles cannot handle new customers since it is a small scale operation. Each order is processed only for one style, color, scented / unscented candles at this time. If the customer wants to place another order, a new run is needed.
Style Base Price Scented Price(Additional)
Tea Lights 5.75 1.00
Votives 8.75 2.00
Pillar 12.75 5.00
1. Prompt the user for the style of the candle. T or t for Tea lights, V or v for votives and P or p for Pillars are the acceptable choices. If the user enters any other character, they should be prompted until they enter the correct choice.
Explanation / Answer
#include <cstdlib>
#include <string>
#include<iostream>
#include<math.h>
using namespace::std;
int main(){
char x;
cout<<"enter the color,F or f for Federal Blue, S or s for Sunflower Yellow, C or c for Christmas Red and M or m for Milky White"<<endl;
cin>>x;
for(int i=1; i<=4;){ /*initiating infinite loop */
if(x=='F'|x=='f'|x=='S'|x=='s'|x=='C'|x=='c'|x=='M'|x=='m'){
break;}
else{
cout<<"invalid choice enter again"<<endl;cin>>x;}
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.