Question: When you first learned to divide, you expressed answers using a quotient and a remainder rather than a fraction or decimal quotient. For example, if

When you first learned to divide, you expressed answers using a quotient and a remainder rather than a fraction or decimal quotient. For example, if you divided 9 by 2, you gave the answer as 4r.1 (4 with a remainder of 1). Write a program that takes two integers as inputs and displays their quotient and remainder as outputs. Do not assume that the integers are entered in any order, but be sure to divide the larger integer by the smaller integer.

The code in JAVA that was entered into repl.it is this:

import java.util.Scanner;

public class Main {

public static void main (String[] args) {

Scanner scanner= new Scanner(System.in);

int a = scanner.nextInt();

int b = scanner.nextInt();

if (a > b){numerator = a; denominator = b; }

else { numerator = b; denominator = a;}

Sytem.out.println("Quotient: " + numerator/denominator);

System.out.println("Remainder: " + numerator%denominator);}}

however I recieved these errors:

Main.java:7: error: cannot find symbol if (a > b){numerator = a; denominator = b; } ^ symbol: variable numerator location: class Main Main.java:7: error: cannot find symbol if (a > b){numerator = a; denominator = b; } ^ symbol: variable denominator location: class Main Main.java:8: error: cannot find symbol else { numerator = b; denominator = a;} ^ symbol: variable numerator location: class Main Main.java:8: error: cannot find symbol else { numerator = b; denominator = a;} ^ symbol: variable denominator location: class Main Main.java:9: error: cannot find symbol Sytem.out.println("Quotient: " + numerator/denominator); ^ symbol: variable numerator location: class Main Main.java:9: error: cannot find symbol Sytem.out.println("Quotient: " + numerator/denominator); ^ symbol: variable denominator location: class Main Main.java:9: error: package Sytem does not exist Sytem.out.println("Quotient: " + numerator/denominator); ^ Main.java:10: error: cannot find symbol System.out.println("Remainder: " + numerator%denominator);}} ^ symbol: variable numerator location: class Main Main.java:10: error: cannot find symbol System.out.println("Remainder: " + numerator%denominator);}} ^ symbol: variable denominator location: class Main

can someone help me fix my code?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!