JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Untitled Page | JustPaste.app
21 days ago2 views
👨‍💻Programming
import java.util.Scanner;

public class LabExer1 {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter two numbers.");
        System.out.print("Fist number: ");
        double x = scanner.nextDouble();
        System.out.print("Second number: ");
        double y = scanner.nextDouble();

        plusFive(x, y);

        timesTwo(x, y);

        showSquared(x, y);

        computePercentage(x, y);
    }

    public static void plusFive(double x, double y) {
        System.out.println(x + 5 + " and " + y + 5);
    }

    public static void timesTwo(double x, double y) {
        System.out.println(x * 2 + " and " + y * 2);
    }

    public static void showSquared(double x, double y) {
        System.out.println(x * x + " and " + y * y);
    }

    public static void computePercent(double x, double y) {
        double percentage = (x / y) * 100;
        System.out.println(x + " is " + percentage + " percent of " + y);

    }
}
← Back to timeline