100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CSC 110 Assignment 3 (2.9-2.15 and 3.1-3.2) EXAM QUESTIONS WITH CORRECT ANSWERS.

Rating
-
Sold
-
Pages
10
Grade
A
Uploaded on
30-11-2025
Written in
2025/2026

CSC 110 Assignment 3 (2.9-2.15 and 3.1-3.2) EXAM QUESTIONS WITH CORRECT ANSWERS.8. Cookie Calories A bag of cookies holds 40 cookies. The calorie information on the bag claims that there are 10 servings in the bag and that a serving equals 300 calories. Write a program that lets the user enter the number of cookies he or she actually ate and then reports the number of total calories consumed. - CORRECT ANSWERpackage javacookies; import .Scanner; public class JavaCookies { public static void main(String[] args) { int cookieCount; Scanner keyboard = new Scanner(S); Sln("Enter number of cookies eaten:"); cookieCount = Int(); int servingSize = 40/10; double caloriesPerCookie = 300/servingSize;

Show more Read less
Institution
Course









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Course

Document information

Uploaded on
November 30, 2025
Number of pages
10
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

CSC 110 Assignment 3 (2.9-2.15 and 3.1-3.2) EXAM
QUESTIONS WITH CORRECT ANSWERS.

8. Cookie Calories

A bag of cookies holds 40 cookies. The calorie information on the bag claims that there are

10 servings in the bag and that a serving equals 300 calories. Write a program that lets the

user enter the number of cookies he or she actually ate and then reports the number of total

calories consumed. - CORRECT ANSWER✅✅package javacookies;




import java.util.Scanner;

public class JavaCookies {



public static void main(String[] args) {



int cookieCount;

Scanner keyboard = new Scanner(System.in);

System.out.println("Enter number of cookies eaten:");

cookieCount = keyboard.nextInt();



int servingSize = 40/10;

double caloriesPerCookie = 300/servingSize;

double totalCalories = cookieCount * caloriesPerCookie;



System.out.println("Your calorie intake was: " + totalCalories

+ " calories");



}

, }



A comment starts with what characters? - CORRECT ANSWER✅✅//



Assume that a boolean variable isQuadrilateral has been declared, and that another variable,
numberOfSides has been declared and initialized. Write a statement that assigns the value true if
numberOfSides is exactly 4 and false otherwise. - CORRECT ANSWER✅✅if(numberOfSides==4)

isQuadrilateral = true;

else

isQuadrilateral = false;



Assume that a boolean variable workedOvertime has been declared, and that another variable,
hoursWorked has been declared and initialized. Write a statement that assigns the value true to
workedOvertime if hoursWorked is greater than 40 and false otherwise. - CORRECT
ANSWER✅✅if(hoursWorked > 40)

workedOvertime = true;

else

workedOvertime = false;



Assume that c is a char variable has been declared and already given a value. Write an expression whose
value is true if and only if c is a newline character. - CORRECT ANSWER✅✅c == '\n'



Assume that c is a char variable has been declared and already given a value. Write an expression whose
value is true if and only if c is a tab character. - CORRECT ANSWER✅✅c == '\t'



Assume that isIsosceles is a boolean variable, and that the variables isoCount,triangleCount, and
polygonCount have all been declared and initialized. Write a statement that adds 1 to each of these
count variables (isoCount,triangleCount, andpolygonCount) if isIsosceles is true. - CORRECT
ANSWER✅✅if(isIsosceles == true)

{

isoCount +=1;

triangleCount +=1;
$11.69
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
StudyAceHub

Get to know the seller

Seller avatar
StudyAceHub Abacus College, Oxford
Follow You need to be logged in order to follow users or courses
Sold
1
Member since
11 months
Number of followers
0
Documents
731
Last sold
1 month ago
Comprehensive Study Guides materials and simplified exam prep Q and A .

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions