1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
White raven [17]
3 years ago
6

Write a C++ program that displays the appropriate shipping charge based on the region code entered by the user. To be valid, the

region code must contain exactly three characters: a letter (either A or B) followed by two numbers. The shipping charge for region A is $25. The shipping charge for region B is $30. Display an appropriate message if the region code is invalid. Use a sentinel value to end the program. Save and then run the program. Test the program using the following region codes: A11, B34, C7, D2A, A3N, C45, and 74TV.
Computers and Technology
1 answer:
gregori [183]3 years ago
3 0

Answer:

Following are the code to the given question:

#include <iostream>//header file

#include <string>//header file

using namespace std;

int main()//main method

{

string region;//defining a string variABLE

while(true)//defining a while loop for input value

{

cout << "Enter the region code(-1 to quit): ";//print message

cin >> region;//input string value

if(region == "-1")//defining  if to checks string value

{

break;//use break keyword

}

else//else block

{

if(region.length() != 3)//defining if to check string value length not equal to 3  {

cout<<"Invalid region code. Region code must contain exactly three characters."<<endl;//print message

}

else

{

if(region.at(0) == 'A' || region.at(0) == 'B')//defining at method that checks string value

{

if((region.at(1) >= '0' && region.at(1) <='9') && (region.at(2) >= '0' && region.at(2) <='9'))//defining at method that checks string value

{

if(region.at(0) == 'A')//defining at method that checks string value

{

cout<<"The shipping charge for region is $25."<<endl;//print message

}

else

{

cout<<"The shipping charge for region is $30."<<endl;//print message

}

}

else

{

cout<<"Invalid region code. Region code should start with A or B followed by two numbers."<<endl;//print message    

}

}

else

{

cout<<"Invalid region code. Region code should start with A or B."<<endl;//print message

}

}

}

}

return 0;

}

Output:

Please find the attached file.

Explanation:

In this code, inside the main method a string variable "region" is declared that use while loop to the input value and use the conditional statement that checks the input value and print the value as per the condition and print the value.

You might be interested in
In black and white,<br><br> we must be more conscious of image
scZoUnD [109]

is it true or false is so it is false

3 0
3 years ago
Michael Holliday is a business systems analyst who is working on a feasibility study for a new​ e-911 system for the city of Mem
postnew [5]

Answer:

E

Explanation:

The requirement analysis phase is a very key vital phase of the system life cycle in which a system designer sees the future result of his input in the system he intends to design, the requirement analysis clearly state the result of any system in progress design and proccess stage

7 0
3 years ago
Arturo is a security professional. He is strengthening the security of an information system. His design ensures that if a field
Cloud [144]

Arturo is attempting to protect the database (data) of an information system (IS).

<h3>What is an information system?</h3>

An information system (IS) can be defined as a set of computer systems, that is typically used to collect, store, and process data, as well as the dissemination of information, knowledge, and the distribution of digital products.

In Cybersecurity, there are two (2) main techniques that can be used to check data when inputted in an information system (IS) and these include:

  • Verification
  • Validation

Data validation is a type of check which is primarily performed by a software program (application) to make sure that the data which is entered into an information system (IS) is allowable and sensible.

This ultimately implies that, any data that is not allowed or sensible are rejected and discarded by the computer system.

In conclusion, we can deduce that Arturo is attempting to protect the database (data) of an information system (IS).

Read more on data here: brainly.com/question/25885448

3 0
2 years ago
David is working in a database that organizes student exam grade information. He needs to find all students who have scored 100
kobusy [5.1K]

Answer:

David can apply filter to the data in order to show only records that meet the criteria.

Explanation:

  • Filter is a very helpful option that displays the records that you want to view, hiding rest of the unwanted records.
  • Sometimes you want to extract and view only the records that match a specific criteria instead of viewing all the records.
  • For example in the CUSTOMERS table which contains names, addresses, countries of customers. There are several customers from different countries but you only want to view the customers from Spain. So you can use filter feature to view all the customers from country Spain.
  • In MS Access you can apply filters using Sort & Filter group in the Home tab by selecting the desired column. In SQL, WHERE clause can be used along with SELECT to for filtering and extracting certain records. SELECT will select the records from the table and WHERE clause will specify the criteria to select the certain records.
7 0
3 years ago
What is 4991 rounded to the nearest thousand
evablogger [386]

Answer:

5000

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • Which social media marketing concept engages visitors, getting them to revisit your website and tying them to offline events for
    7·2 answers
  • Lance has three tables in his database he wants to generate a report to show the data from the three table so he decides to link
    6·2 answers
  • How has technology affected the way that you produce art like photographs?
    8·1 answer
  • The identification of critical information is a key part of the OPSEC process because: a) It is required by the JTF commander to
    13·1 answer
  • There are a few simple rules that you can follow to store and manage files and folders in your computer. What is the most import
    9·2 answers
  • Technician A says that S-cams can be left or right handed. Technician B says that S-cam foundation brakes can have one or two an
    15·1 answer
  • PLEASE HELP!! Kou converged his Word document to a PowerPoint document. When he received the PowerPoint, he was missing material
    12·1 answer
  • In 3-5 sentences describe whether or not files should be deleted from your computer explain your answer
    12·1 answer
  • Wha are the types of slide show? define​
    10·1 answer
  • Quick I need help ASAP
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!