Great Deal! Get Instant \$10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

# Programming Assignment 3 Instructions Exercise 4.12: Write an application that calculates the product of the odd integers from 1 to 15. Exercise 4.16 JHTP (Bar Chart Printing Program): One...

Programming Assignment 3 Instructions

Exercise 4.12: Write an application that calculates the product of the odd integers from 1 to 15.

Exercise 4.16 JHTP (Bar Chart Printing Program): One interesting application of computers is to display graphs and bar charts. Write an application that reads 5 numbers between 1 and 30. For each number that reads, your program will display the same number of adjacent asterisks. For example, if your program reads the number 7, it will display *******. Display the bars of asterisk after you read all 5 numbers.

Answered Same Day Jun 30, 2021

## Solution

Yogesh answered on Jul 01 2021
Sol_1.java
Sol_1.java
public class Main {
public static void main(String[] args) {

Initialise variables for starting and ending numbers and result(products of numbers)
int num1 = 1;
int num2 = 15;
int result = 1;

for loop iterates over the range from starting to ending numbe
for(int i = num1; i<= num2; i++){

if loop checks for Odd integers and if the number is Odd then calculate product
if(i % 2 != 0){

System.out.println(i);
result = result * i;
}
}
...
SOLUTION.PDF