i am doing some machine program that our teacher. told us to do, i have figured out how to solve it, the first output is correct but the second one gives me an answer of 3.10752688172043, and the answer should be 3.75268817.
here is my code...

``````using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BeefPrice
{
class Beef
{
static void Main(string[] args)
{
Console.WriteLine("*********WELCOME USER**********");
double packageA ;
double packageB;

double percent = 0.01;
double ress;
double resultA;
double result;
double resultB;
double result1;
Console.WriteLine("Price for beef package A: ");

Console.WriteLine("Percent for lean package A: ");
resultA = ress * percent;
result = packageA / resultA ;

Console.WriteLine("Price for beef package B: ");
Console.WriteLine("Percent for lean package B: ");
resultB = ress * percent;
result1 = packageA / resultB;
Console.WriteLine("The price of package A: " + result );
Console.WriteLine("The price of package B: " + result1 );

if (result  < result1  )
{
Console.WriteLine("The best choice is package A");

}
else
{
Console.WriteLine ("The best choice is package B");
}
if (result  == result1  )
{
Console.WriteLine("They have the same value");

}

}
}
}
``````

the program runs like this
price for package A:
2.89
Percent for package A:
85
price for package A:
3.49
Percent for package A:
93
The price of package A: 3.4
The price of package B: 3.75268817
The best choice is package A

Line 35 is the problem :)

commented: haha thanks :) +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.