Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need for my code to display the shipping charge for Hawaii and Oregon. If ther

ID: 3643403 • Letter: I

Question

I need for my code to display the shipping charge for Hawaii and Oregon.
If there is anything else entered it should display "incorrect state"
As of now it will compile and run but it displays "0" no matter what is entered.

Here is my code so far.

#include <iostream>
#include <string>
#include <algorithm>

using std::cout;
using std::cin;
using std::endl;
using std::string;

int main()
{
//declare variables
string state = "";
int shipCharge = 0;
const int Hawaii = 30;
const int Oregon = 30;

//enter input item
cout << "Enter the state name: ";
cin >> state;
getline(cin, state);


//assign shipping charge
if (state == "Hawaii")
{
cout << shipCharge << "Hawaii" << endl;
}
else (state = "Oregon");
{
cout << shipCharge << "Oregon" << endl;
}

// end if

//display shipping charge
cout << "Shipping charge: " << shipCharge << endl;

return 0;
} //end of main function

Explanation / Answer

you have assigned the value 0 for the ship charge and dint change it as you go along the program

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote