Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Creating Patterns with Stars and Convert Change into Dollars, Quarters, Nickels, Dimes, and Pennies

Creating Patterns with Stars Using For Loops

 For the first one I was looking to add a prompt that either lets the user choose what symbols to use for drawing, or lets them choose whether they would like a right or left triangle of stars. (or both even). Here are the instructions: Start by creating some code to print a single line of asterisks ("*") of any given length. Use a for loop. Make sure to use different looping variables for the outer and inner loops! Wrap this code in another for loop to repeat it and create a square of asterisks. Adjust the conditions on your inner for loop to limit the number of asterisks printed based on the state of the outer loop's variables. Experiment with different looping conditions, conditional branches, and extra inputs to create different patterns. and here is what I have so far: public static void main(String[] args) { System.out.print("How many rows of stars would you like to create?"); Scanner input = new Scanner(System.in); int row = input.nextInt(); for (int a=0; a<=row; a++){ for (int b=0; b<=a-1; b++){ System.out.print ("*"); } System.out.print("\n"); }// end of for }// end of main Another issue I was having was with this code where I'm trying to get the output to convert change into dollars, quarters, nickels, dimes, and pennies. It will prompt the user to enter an amount, but it still only gives the dollars, quarters and cents no matter what I do. This is the code: import java.util.Scanner; public class ModulusExamples { public static void main(String[] args) { //1. Declare variable double money, cost; int dollars, quarters, dimes, nickels, pennies; int cents; String name; Scanner input = new Scanner(System.in); int COST_PER_DOLLAR = 100; //2. Input System.out.println(" Please enter your name"); name = input.nextLine(); System.out.println("how much money would you like the change for?"); money = input.nextDouble(); //3. Calculation cost = (money * 100); cents = (int)cost; dollars = (cents / 100); quarters = (cents /25); dimes = (cents /10); nickels = (cents /5); pennies = (cents % COST_PER_DOLLAR); //4. Output System.out.println(quarters + " Quarters"); System.out.println(dimes + " Dimes"); System.out.println(nickels + " Nickels"); System.out.println(pennies + " Pennies"); }// end of main }//end of class Are you able to help with either of these things? If so it would be a lifesaver! I've been trying to get help with it for weeks now but can't seem to get anywhere. Thanks in advance!

support
close