Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello there , I need help with my assignment , please follow steps & clear answers . COMP 1900-Fall 2018 Lab 4: Basic Loops (15

Hello there , I need help with my assignment , please follow steps & clear answers . image text in transcribed
image text in transcribed
COMP 1900-Fall 2018 Lab 4: Basic Loops (15 pts) Number of People: Individual Duc: By the end of your lab session today. You MUST submit this before leaving the lab. Grader: Please refer to the COMP 1900 syllabus for your lab TA. Questions about grading? Contact him/her first Coding Style: Use camelCase for variable names, use consistent indentation in your code, and include a reasonable amount of comments throughout your code. The TAs may deduct points for poor coding style Within the 1900 folder on your desktop, create a new folder named Lab4. 1. (3 pts) Within your Lab4 folder, write a program named Powers-java that gets user input for two integers a and b, then computes and displays the value of a. You may assume that both a and b are non-negative. Sounds pretty easy, right? The catch here is that you cannot use Math.pow; instead, compute the by repeatedly multiplying axax... x a for b times. Your code should work for any non-negative values of a and b, including zero. (Remember that anything to the Oth power is 1.) result (4 pts) Within your Lab4 folder, write a program named Factorials.java that gets user input for an integer n, then computes and displays the value of n! You may assume that n is non-negative.n (pronounced "n factorial") is defined as nx (n-1)x (n-2)x..x 1. For example, 5! -5 x4x3x2x 2. 1 = 120. Your program should work for any reasonably small non-negative value of n, including zero (note that 0! has a value of 1). Factorials get large very quickly, so use the long data type to store your result. Problem 3 is on the back!)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions