Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

{So i need help with this. I already wrote it out but i have 8 errors still and i cant seem to find out why.

{So i need help with this. I already wrote it out but i have 8 errors still and i cant seem to find out why. Can someone help me? Also this is my first time doing C# so i dont know much}

start

string name

string address

num item //use int

num quantity

num price //use double as data type

num SIZE = 6

num VALID_ITEM [SIZE] = 106, 108, 307, 405, 457, 688 //use int as data type

num VALID_ITEM_PRICE [SIZE] = 0.59, 0.99, 4.50, 15.99, 17.50, 39.00 //use double as data type

num i

bool foundIt = false

string MSG_YES = Item available

string MSG_NO = Item not found

get name, address, item, quantity

i = 0

while i < SIZE

if item == VALID_ITEM [i] then

foundIt = true

price = VALID_ITEM_PRICE [i]

endif

i = i + 1

endwhile

if foundIt == true then

print MSG_YES

print quantity, at , price, each

print Total , quantity * price

else

print MSG_NO

endif

stop

static void Main(string[] args) { string name; string address; int item = 0; int quantity = 0; double price = 0.0;

int SIZE = 6;

int VALID_ITEM = new int[] { 106, 108, 307, 405, 457, 688 }; double VALID_ITEM_PRICE = new double[]{ 0.59, 0.99, 4.50, 15.99, 17.50, 39.00 }; int i;

bool foundIt = false;

string MSG_YES = "Item available"; string MSG_NO = "Item not found";

Console.WriteLine("Enter your name:", name); name = Console.ReadLine(); Console.WriteLine("Enter your address:", address); address = Console.ReadLine(); Console.WriteLine("Enter the item: {0}", item); item = Console.ReadLine(); Console.WriteLine("Enter the quantity for the item: {0}", quantity); quantity = Console.ReadLine();

i = 0;

while (i < SIZE) { if (item == VALID_ITEM[i]) { foundIt = true; price = VALID_ITEM_PRICE[i]; } i = i + 1; }

if (foundIt == true) { Console.WriteLine(MSG_YES); Console.WriteLine(quantity + "at" + price + "each"); Console.WriteLine("Total" + quantity * price); }

else { Console.WriteLine(MSG_NO); } Console.ReadKey();

} } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions