menu
Qamnty
Login
Register
My account
Edit my Profile
Private messages
My favorites
Write a program named IntegerExpressions that asks the user for three integers. The program must then output results based on the following calculations: firstResult = The sum o…
Ask a Question
Questions
Unanswered
Tags
Ask a Question
Write a program named IntegerExpressions that asks the user for three integers. The program must then output results based on the following calculations: firstResult = The sum o…
asked
Nov 22, 2023
7.1k
views
0
votes
Write a program named IntegerExpressions that asks the user for three integers.
The program must then output results based on the following calculations:
firstResult = The sum of firstInt and secondInt divided by thirdInt
secondResult = The product of secondInt and thirdInt divided by the sum of secondInt and firstInt
thirdResult = The product of firstInt and thirdInt mod by the secondInt
Note:
firstInt, secondInt, and thirdInt represent the three integers entered by the user.
firstResult, secondResult, and thirdResult represent the results of the calculations.
n mod m means the remainder obtained when n is divided by m.
The prompt to the user to enter the integers must be:
Enter firstInt:
Enter secondInt:
Enter thirdInt:
The output must be in the format:
First Result = firstResult
Second Result = secondResult
Third Result = thirdResult
Please make sure to end each line of output with a newline.
Please note that your class should be named IntegerExpressions.
My code:
import java.util.Scanner;
public class IntegerExpressions {
public static void main(String[] args) {
Scanner = new Scanner(System.in);
int userInput = scnr.next();
int firstInt;
int secondInt;
int thirdInt;
firstInt = userInput;
secondInt = userInput;
thirdInt = userInput;
int firstResult = (firstInt + secondInt)/ thirdInt;
int secondResult; (secondInt * thirdInt)/(secondInt + firstInt);
int thirdResult; firstInt * thirdInt % secondInt;
System.out.println("First Result = " + firstResult);
System.out.println("Second Result = " + secondResult);
System.out.println("Third Result = " + thirdResult);
}
}
Error Messages:
IntegerExpressions.java:16: error: not a statement
int secondResult; (secondInt * thirdInt)/(secondInt + firstInt);
^
IntegerExpressions.java:17: error: not a statement
int thirdResult; firstInt * thirdInt%secondInt);
^
IntegerExpressions.java:17: error: ';' expected
int thirdResult; firstInt * thirdInt%secondInt);
^
3 errors
I have no clue where I'm going wrong please help.
Computers & Tech
college
Dbaxime
asked
by
Dbaxime
8.6k
points
answer
comment
share this
share
0 Comments
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
1
Answer
2
votes
Answer:
its the first result and reread the second result
Step-by-step explanation:
Eric Miller
answered
Nov 29, 2023
by
Eric Miller
7.6k
points
ask related question
comment
share this
0 Comments
Please
log in
or
register
to add a comment.
← Prev Question
Next Question →
Related questions
asked
May 11, 2024
222k
views
Write a program named IntegerExpressions that asks the user for three integers. The program must then output results based on the following calculations: firstResult = The sum of firstInt and secondInt
Stevelove
asked
May 11, 2024
by
Stevelove
8.4k
points
Computers & Tech
college
1
answer
5
votes
222k
views
Ask a Question
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.
Categories
All categories
Mathematics
(3.7m)
History
(955k)
English
(903k)
Biology
(716k)
Chemistry
(440k)
Physics
(405k)
Social Studies
(564k)
Advanced Placement
(27.5k)
SAT
(19.1k)
Geography
(146k)
Health
(283k)
Arts
(107k)
Business
(468k)
Computers & Tech
(195k)
French
(33.9k)
German
(4.9k)
Spanish
(174k)
Medicine
(125k)
Law
(53.4k)
Engineering
(74.2k)
Other Questions
“What does it mean when we “rework” copyrighted material?”
describe an advance in technology that makes life more enjoyable. what discoveries contribute to this technology?
Disadvantages of using animation in advertising? advantages and disadvantages of using animation for education? advantages and disadvantages of using animation in entertainment?
Twitter
WhatsApp
Facebook
Reddit
LinkedIn
Email
Link Copied!
Copy
Search Qamnty