Question: The Wireless department of Costco Wholesale store has promotions for blackfriday.  if you buy Note 20 and make a contract with Verizon as your carrier then you will get $300. if you buy iphone12 and make a contract with AT&T then you will get one iPhone8 free, if you buy Galaxy 20 ultra or Galaxy 20 FG, and you make a contract with T-mobile then you will get $200. if you buy Galaxy watch3 or apple watch 6 and make a contract with Verizon then you will get another watch free.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Question: The Wireless department of Costco Wholesale store has promotions for blackfriday. 
  • if you buy Note 20 and make a contract with Verizon as your carrier then you will get $300.
  • if you buy iphone12 and make a contract with AT&T then you will get one iPhone8 free,
  • if you buy Galaxy 20 ultra or Galaxy 20 FG, and you make a contract with T-mobile then you will get $200.
  • if you buy Galaxy watch3 or apple watch 6 and make a contract with Verizon then you will get another watch free.
Write a C++ program that asks the user to enter a device he/she wants to purchase and the Carrier he wants to make a contract with.
Hint: Hence you have only two variables: Device, Carrier
 
Expert Solution
Step 1

 

PROGRAM:

#include<iostream>

#include<string> //to use getline()

using namespace std;

int main()

{

    string Device,Carrier;     

    cout<<"Enter the device to purchase"<<endl; 

    getline(cin,Device); //read device name through getline() which takes total line as string

    cout<<"Enter the Carrier to make contract"<<endl;

    getline(cin,Carrier); //read carrier

    if(Device=="Note 20" && Carrier=="Verizon")   

    cout<<"promotion is $"<<300<<endl; //prompt user promotion is 300

    else if(Device=="iphone12" && Carrier=="AT&T")

    cout<<"iPhone8 Free"<<endl; //prompt user about iPhone8 Free

    else if((Device=="Galaxy 20 ultra" || Device=="Galaxy 20 FG") && Carrier=="T-mobile")

    cout<<"promotion is $"<<200; //prompt user promotion is 200

    else if((Device=="Galaxy watch3" || Device=="apple watch 6") && Carrier=="Verizon")

    cout<<"Another watch free!!"; //prompt user watch is free

    

}

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Network Protocols
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education