0% found this document useful (0 votes)
5 views3 pages

Java Pseudocode for Profit Calculation

This document discusses a Java program that calculates profit or loss based on income and cost. The program takes income and cost as input from the user, compares the two values, and prints either the profit if income is greater than or equal to cost, or the loss if income is less than cost. It includes the pseudocode, source code in Java using classes and methods, and examples of possible output.

Uploaded by

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

Java Pseudocode for Profit Calculation

This document discusses a Java program that calculates profit or loss based on income and cost. The program takes income and cost as input from the user, compares the two values, and prints either the profit if income is greater than or equal to cost, or the loss if income is less than cost. It includes the pseudocode, source code in Java using classes and methods, and examples of possible output.

Uploaded by

CIANDRA PANCHO
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PANCHO, Ciandra V.

Data Structure - Algorithm

IT21S2 CITE004

1. PSEUDOCODE
2. SOURCE CODE

package dataStructures;

import [Link];

public class Salary {


public static void main(String[] args) {

Scanner scan = new Scanner([Link]);

[Link]("Enter value of INCOME: ");


int income = [Link]();

[Link]("Enter value of COST: ");


int cost = [Link]();

[Link]();

if(income>=cost) {
int profit = income - cost;
[Link]("\nPROFIT: "+profit);
}

else {
int loss = cost - income;
[Link]("\nLOSS: "+loss);

}
}

}
3. OUTPUT

- if income is greater than or equal to cost

-else income is not greater than or equal to cost

You might also like