✅ I get an Issue if I lf 2 artikels. how Ican fix this?

double Fleisch = 4.20;
double Marmelade = 2.30;
double Obst = 2.10;
double Multimedia = 12.00;


Console.WriteLine("Heute im Angebot: Fleisch, Marmelade, Obst, Multimedia" );
Console.WriteLine("Geben sie bitte die Ware ein: ");
string Ware = Convert.ToString(Console.ReadLine());
Console.WriteLine("Geben sie die Anzahl von "+Ware+" an:");
double Anzahl = Convert.ToDouble(Console.ReadLine());



if (Ware == "Fleisch") {
double Ergebnis = Anzahl * Fleisch;
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Fleisch.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
if (Ware == "Marmelade")
{
double Ergebnis = Anzahl * Marmelade;
Math.Round(Ergebnis, 2);
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Marmelade.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
if (Ware == "Obst")
{
double Ergebnis = Anzahl * Obst;
Math.Round(Ergebnis);
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Obst.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
if (Ware == "Multimedia")
{
double Ergebnis = Anzahl * Multimedia;
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Multimedia.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
double Fleisch = 4.20;
double Marmelade = 2.30;
double Obst = 2.10;
double Multimedia = 12.00;


Console.WriteLine("Heute im Angebot: Fleisch, Marmelade, Obst, Multimedia" );
Console.WriteLine("Geben sie bitte die Ware ein: ");
string Ware = Convert.ToString(Console.ReadLine());
Console.WriteLine("Geben sie die Anzahl von "+Ware+" an:");
double Anzahl = Convert.ToDouble(Console.ReadLine());



if (Ware == "Fleisch") {
double Ergebnis = Anzahl * Fleisch;
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Fleisch.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
if (Ware == "Marmelade")
{
double Ergebnis = Anzahl * Marmelade;
Math.Round(Ergebnis, 2);
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Marmelade.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
if (Ware == "Obst")
{
double Ergebnis = Anzahl * Obst;
Math.Round(Ergebnis);
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Obst.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
if (Ware == "Multimedia")
{
double Ergebnis = Anzahl * Multimedia;
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Multimedia.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
6 Replies
WEIRD FLEX
WEIRD FLEX3mo ago
what lf would be? what is the error?
Nicolas Matheisen
Hmm no error but it called maybe bug? If I enter after the quetion of the item: Obst , Fleisch then it dosnt work that he consolewriteline each input and if the user enter just a number in Anzahl(how many) I only lf 1 of the 4 possibile items
SparkyCracked
SparkyCracked3mo ago
No comments sad
Nicolas Matheisen
XD true
WEIRD FLEX
WEIRD FLEX3mo ago
are you saying that user should have the possibility to enter more than one Fleisch, Marmelade, Obst, Multimedia?
Nicolas Matheisen
I am finished the teacher explain it but he do it realy different
Want results from more Discord servers?
Add your server
More Posts
Unable to add migration -So i am having a working ASP.NET application running .NET 8.0. At first everything runs normally butCreating 2 one-to-one relationships with a composite foreign key, EF Code FirstHello everyone, I'm trying to make a database with 2 one-to-one relationships with a composite foreiPop up exe doesn’t run on log inI have a batch login script that runs for all users in my OU. This script runs a Windows Forms app IHow Can I Pull 900K Records From My Database & Not Have The Page Slow Down When Rendering The RecordI have a project that is pulling 900K records from a database & displaying them to a view. Whenever help with shared code between 2 projectsis there a way to have shared code between 2 entirely separate .csprojs? for something like usings oSystem.Data.SQLite command executions slower if a transaction is not explicitly passedI am coping a large amount of data row by row from one table to other. If I initialize a transactionBeginner in EF Core and SQL Server in need for helpHello, I am new here but I needed some help using my project. I need to connect to a SQL Server DB uMediatR pipeline problem: One Notification to three different handlers based on notificationI'm dead stuck on a problem. I'm working on a project and instead of looping through a bunch of if sWallClimb ScriptMy script i made isn't working, i think its because the player has rigidbody so it cant move verticaReading in a File 2D ArraysI have to code a program that will read in a 2D array of 9 x 9 integers from a file that represents