C++ Saved Program: peaceful-mountain

facebook share

Here's the online compiler accompanied with IDE at your service. This is a saved code by one of our users. Try it out or save your own from the IDE page and don't forget to leave a feedback. You can find that at the bottom of the page.


import java.util.Scanner;

class item
{
void xyz()
{
Scanner c=new Scanner(System.in);
	System.out.println("Enter item name:");
	String name=c.next();
	System.out.println("Enter item number:");

int no=c.nextInt();

}
}
class amount extends item
{
	public void aa()
	{Scanner c=new Scanner(System.in);

	System.out.println("Enter quantity:");
	int d=c.nextInt();
	System.out.println("Enter unit price:");
float p=c.nextFloat();
double dis=(0.2*p)*d;
double net=(p*d)-dis;
System.out.println("Discount:"+dis);
System.out.println("Net price:"+net);
	}
}
public class s
{
public static void main(String args[])
{
	item i=new item();
amount a=new amount();
a.xyz();
a.aa();
}
}
Execute

Output

Press the execute button or CTRL + enter to run code.

Inputs