trying to devise a calculation

hi i need some help with this question

For Valentine’s Day, Daisy’s Flower shop sells roses based on the following pricing structure:
$15.00 per rose up to the first 6 roses
$13.00 per rose for the next 12 roses
$10.00 per rose for any additional roses
Write a program that inputs the number of roses purchased and calculates and prints the total cost of the roses.


this is the code i've managed to put together so far

package javaapplication1;
import java.util.Scanner;

public class FlowerShop {
public static void main(String[]args) {
Scanner input = new Scanner (System.in);
int p;
double total_price=0;

System.out.println("How many roses do you wish to purchase?");
p=input.nextInt();

if
(p<=6){
total_price = (p * 15);
System.out.println("The number of roses purchased is " + p + " at a price of " + total_price );
}

else if
((p<=6 || p>6 && p<=18)){

//i need to put in a calculation here where it will calculate the cost of the 1st 6 roses at $15
//and the remainder roses by $13 and show the total cost of the roses purchased
//total_price = (p) ;

System.out.println("The number of roses purchased is " + p + " at a price of " + total_price );
}

else {if
(p>18)

// i need to put in a calculation where it will calculate the cost of the 1st 6 roses at $15
// the next 12 roses at $13 and any other roses purchased at $10 and show the total cost of the roses purchased

//total_price = (p + 10);
{
System.out.println("The total number of roses purchased is " + p + " at a price of " + total_price );

}


}
}}


can anyone assist


Last edited on
Topic archived. No new replies allowed.