CHALLENGE ACTIVITY 1.8.1: Compute an expression. Write a statement that assigns finalResult with the sum of num1 and num2, divided by 3. Ex: If num1 is 4 and num2 is 5, finalResult is 3.
CHALLENGE ACTIVITY 1.8.1: Compute an expression. Write a statement that assigns finalResult with the sum of num1 and num2, divided by 3. Ex: If num1 is 4 and num2 is 5, finalResult is 3.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
CHALLENGE ACTIVITY
1.8.1: Compute an expression.
Write a statement that assigns finalResult with the sum of num1 and num2, divided by 3. Ex: If num1 is 4 and num2 is 5, finalResult is 3.

Transcribed Image Text:CTU Class Homepage.
zy Section 1.8 - CS 226T: Java Progra X
✰ learn.zybooks.com/zybook/CS226-2204A-03-2204A/chapter/1/section/8
= zyBooks My library > CS 226T: Java Programming home > 1.8: Arithmetic expressions (int)
422784.2543518.qx3zqy7
5
6
7
8
9
10
11
12
13
14
15
AHABAANN
16
17
18
19
20
21
22}
pu
}
LUL
Scanner scnr = new Scanner(System.in);
int num1;
int num2;
int finalResult;
num1 = 4;
num2 = 5;
finalResult
Coding Challenge Activity Notes X +
num1 scnr.nextInt();
num2 = scnr.nextInt();
Testing with 4,5
MATTHILD 8/
=
System.out.print("Final result: ");
System.out.println(finalResult);
X Testing with 4, 11
Output differs.
Run X Not all tests passed
(num1 + num2) / 3;
Your output
Your output Final result: 3
highlights below.
Final result: 3
Expected output Final result: 5
zyBooks catalog
1 test
passed
All tests
passed
? Help/FAQ
Stacey Queen
X
:
7:40 AM
8/10/2022
![CTU Class Homepage.
SCTU Messenger
✰ learn.zybooks.com/zybook/CS226-2204A-03-2204A/chapter/1/section/8
= zyBooks My library > CS 226T: Java Programming home > 1.8: Arithmetic expressions (int)
CHALLENGE
ACTIVITY
422784.2543518.qx3zqy7
5
6
7
Write a statement that assigns finalResult with the sum of num1 and num2, divided by 3. Ex: If num1 is 4 and num2 is 5,
finalResult is 3.
1 import java.util.Scanner;
2
3 public class ComputingFinalResult {
9
10
11
EZENSKI
12
13
14
15
16
1.8.1: Compute an expression.
17
18
zy Section 1.8 - CS 226T: Java Progra X
Run
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int num1;
int num2;
int finalResult;
num1 scnr.nextInt ();
num2 = scnr.nextInt ();
num1 = 4;
num2 = 5;
finalResult (num1 + num2) / 3;
X Not all tests passed
Testing with 4,5
Your output
X Testing with 4, 11
Coding Challenge Activity Notes x b Password Reset | bartleby
Final result: 3
zyBooks catalog
1 test
passed
All tests
passed
? Help/FAQ
Stacey Queen
X
:
8:21 AM
8/10/2022](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F788fc729-a951-45c4-9909-47eea7bbf82f%2F65d0dbd6-4eb7-4800-be2f-365553c9e674%2F8h6umcd_processed.png&w=3840&q=75)
Transcribed Image Text:CTU Class Homepage.
SCTU Messenger
✰ learn.zybooks.com/zybook/CS226-2204A-03-2204A/chapter/1/section/8
= zyBooks My library > CS 226T: Java Programming home > 1.8: Arithmetic expressions (int)
CHALLENGE
ACTIVITY
422784.2543518.qx3zqy7
5
6
7
Write a statement that assigns finalResult with the sum of num1 and num2, divided by 3. Ex: If num1 is 4 and num2 is 5,
finalResult is 3.
1 import java.util.Scanner;
2
3 public class ComputingFinalResult {
9
10
11
EZENSKI
12
13
14
15
16
1.8.1: Compute an expression.
17
18
zy Section 1.8 - CS 226T: Java Progra X
Run
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int num1;
int num2;
int finalResult;
num1 scnr.nextInt ();
num2 = scnr.nextInt ();
num1 = 4;
num2 = 5;
finalResult (num1 + num2) / 3;
X Not all tests passed
Testing with 4,5
Your output
X Testing with 4, 11
Coding Challenge Activity Notes x b Password Reset | bartleby
Final result: 3
zyBooks catalog
1 test
passed
All tests
passed
? Help/FAQ
Stacey Queen
X
:
8:21 AM
8/10/2022
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education