0% found this document useful (0 votes)
30 views

Program

The document contains code for a C# program that takes in product name, price, and whether it is on sale as input and calculates the sales amount for 3 days based on whether it is on sale or not.

Uploaded by

Vamsi Gembali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Program

The document contains code for a C# program that takes in product name, price, and whether it is on sale as input and calculates the sales amount for 3 days based on whether it is on sale or not.

Uploaded by

Vamsi Gembali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProgFundamentals7 //DO NOT CHANGE the name of namespace


{
public class Program //DO NOT CHANGE the name of class
'Program'
{
public static void Main(string[] args) //DO NOT CHANGE 'Main'
Signature
{
//Implement your code here
Console.WriteLine("Enter the name of the product :");
string str = Console.ReadLine();

Console.WriteLine("Enter the price of the product :");


int price = Convert.ToInt32(Console.ReadLine());

Console.WriteLine("Is the product on SALE (yes/no) :");


string sale = Console.ReadLine();

// Console.WriteLine("Enter number of the product sold in day 1:");


// int d1 = Convert.ToInt32(Console.ReadLine());

// Console.WriteLine("Enter number of the product sold in day 2 :");


// int d1 = Convert.ToInt32(Console.ReadLine());

// Console.WriteLine("Enter number of the product sold in day 3:");


// int d1 = Convert.ToInt32(Console.ReadLine());
double d1p, d2p, d3p;
if(sale == "yes")
{
// d1p =d1 - d1*(0.07) ; d2p = d1p - d1p*(0.07); d3p = d2p -
d2p*(0.07);
Console.WriteLine("Enter number of product sold in day 1");
int d1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter number of product sold in day 2");
int d2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter number of product sold in day 3");
int d3 = Convert.ToInt32(Console.ReadLine());
d1p = price- price*(0.07);
d2p = d1p - d1p*(0.07);
d3p = d2p - d2p*(0.07);

Console.WriteLine(str);
Console.WriteLine("Day 1 sales total : " + d1p*d1);
Console.WriteLine("Day 2 sales total : " + d2p*d2);
Console.WriteLine("Day 3 sales total : " + d3p*d3);

}
else
{
Console.WriteLine("Enter number of product sold in day 1");
int d1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter number of product sold in day 2");
int d2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter number of product sold in day 3");
int d3 = Convert.ToInt32(Console.ReadLine());

Console.WriteLine(str);
Console.WriteLine("Day 1 sales total : "+ d1*price);
Console.WriteLine("Day 2 sales total : "+ d2*price);
Console.WriteLine("Day 3 sales total : "+ d3*price);
}
}
}
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy