Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment Instructions The Deer Valley Online Auction company needs your help to debug ( fix ) their application that keeps track of seller item prices.

Assignment Instructions
The Deer Valley Online Auction company needs your help to debug (fix) their application that keeps track of seller item prices. The program is not working as it is supposed to, and they want you to fix it!
The Deer Valley Online Auction company requires its sellers to post items for sale for an eight-week period during which the price of any unsold item drops 9 percent each week. For example, an item that costs $15.00 during the first week costs 9 percent less, or $13.65 during the second week. In the third week, the same item is 9 percent less than $13.65, or $12.42.
The program should first prompt the user for a price, then output the price of the item during each of eight weeks. This should repeat until the sentinel value of -999 is entered. After -999 is entered, the program should exit.
Unfortunately, the program is not doing what it is supposed to be doing. You have to get this fixed by the end of the week!
The faulty program code is below. Highlight the code and copy/paste it into the Online GDB compiler. Set the language to C# and run the program.
/******************************************************************************
Program: This is the DV Auction Item Price Program
*******************************************************************************/
using System;
class DVAuction {// class header for DVAuction class
static void Main(){// method header for main method
double itemPrice; // Declaration of variable to hold item's price
Console.WriteLine("Welcome to the Deer Valley Online Auction Program.
");
do // post-test do..while loop to keep asking user about item price
{
Console.WriteLine("Please enter the price of the item (-999 when all done)");
itemPrice = double.Parse(Console.ReadLine());
for (int week =1; week <8; ++week)
{// for loop to repeat the calculation for 8 weeks
itemPrice = itemPrice -(itemPrice *0.9);
// reduce the item's price by 9% each week
Console.WriteLine("The cost after week "+ week +
" is $"+ String.Format("{0:0.00}",itemPrice));
// output week number and new price to Console
}// end for loop
} while (itemPrice >0); // if the item's price was positive,
// let's loop again and ask for another price.
// end do...while loop
Console.WriteLine("
Thank you for using the Deer Valley Online Auction Program. ");
Console.WriteLine("See you again soon!");
}// end main method
}// end DVAuction class

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

Databases Theory And Applications 27th Australasian Database Conference Adc 20 Sydney Nsw September 28 29 20 Proceedings Lncs 9877

Authors: Muhammad Aamir Cheema ,Wenjie Zhang ,Lijun Chang

1st Edition

3319469215, 978-3319469218

Students also viewed these Databases questions

Question

How have your cultural experiences influenced your development?

Answered: 1 week ago

Question

What were your most important educational experiences?

Answered: 1 week ago

Question

Which personal relationships influenced you the most?

Answered: 1 week ago