The owner of a candle shop has asked for your help. The shop sells three types of candles as shown below:


Type Price Burn Time (hours)
1 $2.50 5
2 $3.75 7
3 $5.99 12

The owner wants you to write a program to perform certain calculations when customers buy different numbers of the candles.

Required:
a. Develop an algorithm to satisfy the following requirements:

Prompt the user to enter the number of candles of each type the customer wants to buy. Since you can’t buy a fraction of a candle, the input for each type of candle must be an integer. (You may assume that only integer values between 0 and 10 will be entered when this program is tested.)
Calculate the total price of all the candles bought using the information in the table above. For example, two Type 1 candles and one Type 2 candle would have a total price of $8.75.
Calculate the total burn time of all the candles if they were burned consecutively (i.e., one after the other). For example, one Type 1 and one Type 3 candles would burn for 17 hours.
Calculate the cost-per-minute for that purchase.
Output some kind of meaningful display that includes the number of candles of each type bought, the total price, the total burn time, and the cost-per-minute. You can be as creative as you want with this!
Write the pseudocode for the algorithm and store it in a file (file format can be text, pdf or doc) with the name CandleShopSteps.

b. Write the code (20 points)

Once you've written your algorithm it is time to turn it into a Java program. that can be executed (run). Here are some things to keep in mind:

the class should be name CastleShop.
the program will need to import the Scanner class from the Java util package.
the class should have a main method that will include the logic for the algorithm you developed in Part A. You may choose to add additional methods that are called in the main method.

Answers

Answer 1

Answer:

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

  double cost = 0;

  double priceF, priceS, priceT;

  int nOne = 0, nTwo = 0, nThree = 0;

  int fBurn, sBurn, tBurn;

  int burnTime = 0;

  isEnd = "n";

   while (isEnd == "n"){

      Scanner in = new Scanner(System.in);

      int option = in.nextInt();

      if (option == 1){

            priceF = 2.50;

            fBurn = 5;

            System.out.print("Enter number of items: ");

            nOne += in.nextInt();

            burnTime += fBurn * nOne;

            cost += priceF * nOne;

        } else if (option== 2){

            priceS = 3.75;

            sBurn = 7;

            System.out.print("Enter number of items: ");

            nTwo += in.nextInt();

            burnTime += sBurn * nTwo;

            cost += priceS * nTwo;

        } else if(option == 3){

            priceT = 5.99;

            tBurn = 12;

            System.out.print("Enter number of items: ");

            nThree += in.nextInt();

            burnTime += tBurn * nThree ;

            cost += priceT * nThree;

        } else{

            System.out.println("option must be between 1 and 3");

        }

      System.out.print("Do you want to end the order? y/n: ");

      isEnd = in.nextLine();

  }

  System.out.println("Number of Type 1 candles bought : "+nOne);

  System.out.println("Number of Type 2 candles bought : "+nTwo);

  System.out.println("Number of Type 3 candles bought : "+nThree);

  System.out.println("Total cost is : "+cost);

  System.out.println("Total burn time is : "+burnTime);

  double cpm = (burnTime * 60) / cost;

  System.out.println("Cost per minute : "+cpm);

}

}

Explanation:

The Java program prompts the user to continuously choose from three options 1, 2 and 3. The prices, the burn time and the cost per minute burn of the total candles ordered are printed out.


Related Questions

Given the message size of 16Kb, packet size of 2Kb, speed of 4Kbps over 3 links, how much time, will it take the message to travel from the source to the destination considering there are no packet delays?

Answers

Answer:

5 seconds

Explanation:

Given that :

Message size = 16kb

Packet size = 2kb

Speed = 4kbps

Number of links = 3

The time taken is calculated using the formula :

[Number of packets + (Number of links - 1)] * (packet size / speed)

Number of packets = message size / packet size

Number of packets = 16kb / 2 kb = 8

Hence,

[Number of packets + (Number of links - 1)] * (packet size / speed)

(8 + (3 - 1)) * (2 / 4)

(8 + 2) * (1 /2)

10 * 1/2

= 5 seconds

In order to move the file C:\Data\CustData.txt to C:\BackUp\CustData.txt in a VBScript program, which of the following command would be used( fso is a Scripting.FileSystemObject).

a. fso.MoveFile("C:\Data\CustData.txt","C:\BackUp\CustData.txt")
b. fso.MoveFile("C:\BackUp\CustData.txt", "C:\Data\CustData.txt")
c. fso.FileMove("C:\Data\CustData.txt","C:\BackUp\CustData.txt")
d. fso.FileMove("C:\BackUp\CustData.txt", "C:\Data\CustData.txt")

Answers

Answer:

fso.MoveFile("C:\Data\CustData.txt","C:\BackUp\CustData.txt")

Explanation:

Given

Source = C:\Data\CustData.txt

Destination = C:\BackUp\CustData.txt

Required

Code snippet to move file between directories using VScript

First, we need to write out the syntax.

The syntax to implement this is:

fso.MoveFile(Source Path, Destination Path)

The above line of code instructs the system to move the file from its source directory to its destination.

Note that the source path and destination path must include the full directories and the file extensions

In this case, the correct code is:

fso.MoveFile("C:\Data\CustData.txt","C:\BackUp\CustData.txt")

What are possible consequences for cyberbullying?

Answers

Answer:

Possible consequences for cyber bullying include depression, isolation and illness

Explanation:

The reason for this is when a person is hurt there body tends to go through things to make them feel a certain way about things.

Answer:

Possible consequences of cyberbullying are detention, suspension, or expulsion from school; legal charges or, fines.

Explanation:

How will Excel summarize the data to create PivotTables? summarize by row but not by column summarize by column but not by row summarize by individual cells summarize by row and by column

Answers

Answer:

D. summarize by row and by column

Answer:

D.

Explanation:

Order the steps to use a logical argument as a rule type.

(Click New Rule.)
(Use a formula to determine)
(Click Conditional Formatting)
(Click the Home tab, then click )
(the Styles group)

Answers

Answer:

Click home tab, click conditional formatting, click new rule, use formula to determine

Answer:

1. Home Tab

2. Conditional Formatting

3. New Rule

4. Formula

Explanation:

Just did it on Edge 2021

Plz click the Thanks button!

<Jayla>

Cottonisagoodreflectorofsound​

Answers

Answer:

mhmm

Explanation:

answer Stop it makes me horn y

71 81 77 15 63 96 36 51 77 18 17

Show the contents of the array above each time a Merge Sort changes it while sorting the array into ascending order. Please explain your work and your answer.

Answers

Answer:

Following are the solution to this question:

Explanation:

This algorithm uses the divide and rule approach works, which splits the list into two sublists depending on if they are smaller or larger than the pivotal factor. It has O(n*log n) complexity.

It splits down the list in more than one version frequently till every sublist becomes based on a single element and fuses it to offer an ordered array. The merge type works according. It has O(n*log n) complexity.

Please find the attachment file of the sorting.

Write a method named isVowel that returns whether a String is a vowel (a single-letter string containing a, e, i, o, or u, case-insensitively).public static boolean isVowel(String word){ for(int i=0;i

Answers

Answer:

public static boolean isVowel(String word){

  for(int i=0;i

   char vowels= word.toLowerCase(word.charAt(i));

       if (vowels== "a" || vowels == "e" || vowels== "i" || vowels == "o" ||  vowels == "u" ){

          return true;

       } else {

           return false;

       }

  }

}

Explanation:

The Java source code analyzes each character in a string object and returns true if it is a vowel letter.

Match the definitions of different business communication to the type of document

Answers

Answer:

Convey more factual data that helps facilitate decision making  - REPORTS

Reports are made with factual data to show the condition of the subject so convey more factual data that helps in decision making.

Are one page long  - MEMORANDUMS

Memorandums are used to convey new information and are usually brief which means they take one or two pages.

Are written in a block style, with the body text aligned along the left margin  - BUSINESS LETTERS

Business letters are to be as formal as possible and this includes writing them block style and aligning the text to the left margin.

Allow attachments of files, such as images  - EMAILS

As emails are softcopy and computer based, they allow for the attachment of other files such as images, documents, audio, etc.

Answer:

emails -> allow attachments of files, such as images

reports -> convey more factual data that helps facilitate decision making

memorandums  -> are one page long

business letters  -> are written in a block style, with the body text aligned along the left margin

Explanation:

Hopes this helps.

Isaac is creating a document that combines art and poetry and, for stylistic reasons,
he wants the pages to have Roman numerals instead of the traditional Arabic 1, 2, 3,
etc. What should he choose from the Page Number mini-menu?
Format Page Numbers
Customize Page Number
Insert Number Template
This is not possible in Word.


NEED A ANSWER FAST 7 minutes left

Answers

Answer:

I think it is most probably in customize page number?

Explanation:

I'm not sure let me know if it works or not!!

Ask the user for two numbers. Print only the even numbers between them. You should also print the two numbers if they are even.

Answers

I've included the code in the picture below.

Why is it important to ensure that DNS Servers have been secured before implementing an e-mail system

Answers

Answer:

b. E-mail relies upon DNS MX records to identify hosts that are responsible for e-mail transmission.

Explanation:

It is important to ensure that Domain Name Servers have been secured before implementing an e-mail system because E-mail relies upon DNS MX records to identify hosts that are responsible for e-mail transmission.

In other word, this helps the DNS MX determines the mail server accountable for receiving email messages on behalf of a domain name.

Which sorting algorithm is LEAST efficient when performed on an array in which the values are already in the desired sorted order

Answers

Answer:

Merge sort

Explanation:

The various types of sorting algorithms are

1. Quick sort

2. Bubble sort

3. Selection sort

4. Insertion sort

5. Merge sort

6. Heapsort

The algorithm that performs best for an already sorted list is the insertion sort

While the algorithm that performs worse for an already sorted list is the merge sort since it divides the sorted list into sub list before it operations

Currently, the program blinks both LEDs at the same time, and it's doing so at such a fast rate that you can't tell they're blinking--they appear to always be on.You must change this program so that: The time between Timer 1 interrupts, and therefore changes in the state of the LEDs, is approximately 0.75 sec. The LEDs cycle between 8 states, returning to state 1 after leaving state 8:1. LED2 on2. Both LEDs off3. LED1 on4. Both LEDs off5. Both LEDs on6. Both LEDs off7. LED1 on8. Both LEDs off

Answers

Answer:

Change the time rate/frame to reflect those changesI dont really understand your question, do you want code to be written for this or what?

the last layer in a layered design​

Answers

Answer:

"System Layer" is the right choice.

Explanation:

The above system layer would be the foundation of that same layered system configuration. Hardly any robotic artificial intelligence animation could very well continue indefinitely adequately because without that layer. Several of the essential elements of Machine Learning would be emblazoned throughout this stage of the network. Due to the whole layer, strategic planning requirements could continue indefinitely.

Which navigation icon would you click on to add a new Contact?
O People
O Calendar
O Mail
O Tasks

Answers

the answer would be people
A) people. That is your answer! Hope this helps:)

Problem 1: Triple + Double = So Much Trouble

Write a program that reads two integers, checks if a digit repeats 3 times in a row in the first integer and that same digit repeats two times in a row in the second integer.


Sample input/output:

Enter two integers: 3555761 72559

There are 3 conservative digits 5 in 3555761 and 2 in 72559

Answers

Answer:

Explanation:

The program code is written as:

#include <iostream>

using namespace std;

 

int main() {

    int num1,num2,flag=0,flag1=0,flag_val=0,temp1,temp2,f1,f2,f3,m1,m2;

    cout<<"Enter First Number ";

    cin>>num1;

    cout<<"Enter Second Number ";

    cin>>num2;

    temp1=num1;

    temp2=num2;

    while(temp1>0)

    {

    f1=temp1%10;

temp1=temp1/10;

    f2=temp1%10;

    if(f1!=f2)

       continue;

    temp1=temp1/10;

    f3=temp1%10;

       if(f1==f2 && f2==f3)

       {

       flag=1;

       flag_val=f1;

       }

    }

    while(temp2>0)

    {

    m1=temp2%10;

    temp2=temp2/10;

    m2=temp2%10;

    if (m1!=m2)

       continue;

    temp2=temp2/10;

    if(m1==m2 && flag==1 && flag_val==m1)

    {

       flag1=1;

       break;

    }

   

    }

    if (flag1==1)

    {

    cout<<"Both Number Are Triple + Double";

    }

    else

    {

    cout<<"Both number Are not Triple +Double";

    }

 

return 0;

}

OUTPUT:

Enter First Number = 3555761

Enter Second Number = 72559

Both numbers are Triple + DoublePress any key to continue .....

Cell address A4 in a formula means it is a _________Mixed cell reference​

Answers

Answer:

Relative cell reference.

Explanation:

Microsoft Excel is a software application or program designed and developed by Microsoft Inc., for analyzing and visualizing spreadsheet documents.

A spreadsheet can be defined as a file or document which comprises of cells in a tabulated format (rows and columns) typically used for formatting, arranging, analyzing, storing, calculating and sorting data on computer systems.

A relative cell reference can be defined as a cell whose reference is mainly relative to the location of the cell.

In Microsoft Excel, the cell reference is considered to be a relative reference by default.

Hence, the cell address A4 in a formula means it is a relative cell reference and when the formula is copied, the reference in the formula will change.

For example, if you refer to cell A4 from cell D4, it means you're pointing to the cell that is three (3) columns to the left of the same row i.e D minus A (D - 4).

algorithm that has been coded into something that can be run by a machine.

1. algorithm
2. event
2. program

Answers

the answer is program

Write a C++ program that declares an array alpha of 50 components of type double. Initialize the array so that the first 25 components are equal to the square of the index variable (the position that element will occupy), and the last 25 components are equal to three times the index variable. Output the array so that 10 elements per line are printed. For the number at index 5, the value would be 25, which is 5 squared. The 25th index would hold a value of 75, which is 3 * 25.

Answers

Answer:

#include <iostream>

#include <array>

static std::array<double, 51> nums;

int main()

{

std::array<double, 51> nums;

int for1;

int for2;

for (int i = 0; i < 26; i++)

{

             nums[i] = i;

             for1 = i * i;

             std::cout << for1 << ", ";

             if(i%10==0)

                 std::cout << "\n";

}

for (int i = 26; i < 51; i++)

{

             nums[i] = i;

             for2 = i * 3;

             std::cout << for2 << ", ";

             if (i % 10 == 0)

                 std::cout << "\n";

}

}

hope i helped :D

An instruction for the computer. Many commands put together to
make up algorithms and computer programs.

1. Repeat
2. Command
3. Bug

Answers

Answer:

i think its command but not sure

Match the IP Protections Patent, Copyright and Trademark into the following cases:

a. books, poems
b. music, movies, paintings
c. company logo
d. software
e. combinations of materials to make drugs

Answers

Answer:

A) copyright

B) copyright

C)Trade mark

D) copyright

E)Patent

Explanation:

Patent can be regarded as a form of intellectual property which helps the owner of an invention to others to sell or use the invention for some period of time. Example of this is a patent that protect microwave oven.

trademark is form of intellectual property, this could be inform of symbols, words that differentiate the product of a party from another. Example of this is a bite of apple that represents apple products.

Copyright can be regarded as a legal right given to those that owns a intellectual property which gives him/her right to copy and exclude others from reaping from where they did not sow. The owner get exclusive right to reproduce the copy.

Below is the match of the intellectual property with the examples.

a. books, poems<> Copyright

b. music, movies, paintings<> Copyright

c. company logo<> Trademark

d. software<>Copyright

e. combinations of materials to make drugs<> patent

fill in the blanks the cut and copy commanda are used in combination with the................ command​

Answers

Answer:

paste command.

Explanation:

The Cut and copy commands are used in the combination with the paste command. The cut, copy, and paste commands are used in computers offering an IPC technique to transfer data across the computer user interface.

The cut, copy, and paste commands are related commands and helps human to eliminate monotonous work of recreating data which is available at another place in computer's user interface.

Therefore, the correct answer is paste command.

Which of the following is NOT one of the four benefits of using email?

Answers

Answer:

Can you give choices.

Explanation:




Which is the answer

Answers

Answer:

table

Explanation:

it is meant to do it

fill in the blanks the cut and copy commanda are used in combination with the................ command​

Answers

Answer:

paste command.

Explanation:

The cut and copy commands are used in combination with the paste command. The cut, copy, and paste commands are related commands in human-computer interactions. These commands are interprocess communication in nature, helping to transfer data from one place in the user interface to another place in the user interface.

The cut, copy, and paste commands eliminate monotonous task of creating data which is already present somewhere else in the computer.

Therefore, the correct answer is paste command.

Discuss, in detail, the usefulness of graphics and images in program development. Explain the importance of the interface of a class of objects. Be sure to emphasize the importance of design, color scheme and clarity.

Answers

Answer:

Explanation:

The main importance of graphics and images in program development is user experience. These graphics, color schemes, clarity, images etc. all come together to create a user interface that individuals will be able to easily navigate and use with extreme ease in order to benefit from what the program is intended to do. An interface of a class of objects allows every button and object in the program to grab and share functionality in order for the entire program to run smoothly.

You are a network technician for a small network. Your ITAdmin workstation just stopped communicating with all other computers in the network. You need to diagnose and fix the problem. The following IP addresses are used in this lab:

Location Computer Name IP Address
Networking Closet CorpServer 172.25.10.10
Office 1 Office 1 172.25.10.60
Office 2 Office 2 172.25.10.61
Support Office Support 172.25.10.62
IT Administration ITAdmin 172.25.10.63
Executive Office Exec 172.25.10.64

Answers

Answer:

Ping the other workstations from the IT Admin workstation to confirm that connection has been lost, check the status of the network interface card in the workstation with command ifconfig in the terminal, then reset the connection using ifdown and ifup commands. If the problem is not resolved, check the cable connection.

Explanation:

Ping is an ICMP echo message sent by a network host to another to check for connectivity. If they are connected, the other workstation responds with an ICMP response message.

The ifconfig in Linux systems displays the network adapters and their individual IP configurations. If there is no connection even after the network is reset, then the cable connectors could be the problem.

You are hired by a game design company and one of their most popular games is The Journey. The game has a ton of quests, and for a player to win, the player must finish all the quests. There are a total of N quests in the game. Here is how the game works: the player can arbitrarily pick one of the N quests to start from. Once the player completes a quest, they unlock some other quests. The player can then choose one of the unlocked quests and complete it, and so on.
For instance, let's say that this game had only 4 quests: A, B, C, and D. Let's say that after you complete
• quest A, you unlock quests [B, D). .
• quest B, you unlock quests [C, D).
• quest C, you unlock nothing [ ].
• quest D, you unlock quest [C].
Is this game winnable?
Yes, because of the following scenario:
The player picks quest A to start with. At the end of the quest A, the unlocked list contains [B, D). Say that player chooses to do quest B, then the unlocked list will contain [C, D). Say that player chooses to complete quest C, then the unlocked list will contain quest [D]. Finally, player finishes quest D.
Note that if the player had started with quest C instead of quest A, they would have lost this game, because they wouldn't have unlocked any quest and would be stuck. But the game is still winnable, because there is at least one starting quest which makes the player win. The Journey has N quests, enumerated as {nj, N2, . ng}. We construct a directed graph G for the game, where each node in G represents a quest. If completing quest n; will unlock quest n; then there is a directed edge from n; to n; in the graph. Suppose the total number of edges in the graph is M. (1) We call a quest as a lucky quest if starting from this quest will allow the player to win the game. In the example above, quest A is a lucky quest. Show that (a) All lucky quests are in the same strongly connected component of G, and that (b) Every quest in that component is a lucky quest. [We are expecting a short but rigorous proof for both claims] (2) Suppose there is at least one lucky quest. Give an algorithm that runs in time O(N+M) and finds a lucky quest. You may use any algorithm we have seen in class as subroutine. [We are expecting pseudocode or a description of your algorithm, and a short justification of the runtime]

Answers

Answer:

Explanation:

Let's describe the connected part for the very first time.

Component with good connections:-

A semi in any graph 'G' is defined by a way to align element if this can be crossed from the beginning of any link in that pixel or if this can be stated that there is a path across each organized node pair within this subgram.

Consecrated pair means (ni, nj) and (nj, ni) that 2 different pairs would be regarded.

In point a:

We're going to be using contradictions for this segment. They start with the assumption that two lucky journeys are not even in the same strongly interconnected component.

For instance, qi and qj are providing special quests that were not in the very strongly linked element and which implies that, if we start to cross from qi or qi, then qj cannot be approached if we begin to move through qj and as we established if qi or qj is fortunate contests, we may reach any other hunts. Which implies qj from qi or conversely should be reachable. Or we might claim that qi is part of the strongly linked portion of qj or vice versa with this situation.

Consequently, we would not be capable of forming part of a different and strongly linked element for two successful scientists; they must have the same strongly related to the element.

In point b:

Its definition of its strong, line segment indicates that all other searches within such a strongly coordinate system can be made possible from any quest. Because if all quests are accessible from any quest then a lucky search is named, and all other quests can be accessed from any quest in a very coordinated system. So, all contests are fortunate contests in a strongly connected element.

Algorithm:

Build 'n' size range named 'visited' wherein 'n' is the number of graphic nodes that keep records of nodes already frequented.  Running DFS out of every unknown vertex or mark all edges as seen.  The lucky search will be the last unexplored peak.

Psuedo-Code:

Requires this functionality to also be called Solution, it requires 2 reasons as an input, V is a set of objects in graph 'G' and 'G' is a chart itself.

Solution(V, G):

visited[V] = {false}//assign value

for v: 0 to 'V'-1:  //using for loop

if not visited[v]:  //use if block

DFS(v, visited, V, G)  //use DFS method

ans = v //holding value

return ans //return value

Unwanted email sent to large groups of people who did not request the communication is called _____

Desired
Funmail
Returned
Spam

Answers

Spam mail is the answer
Other Questions
Consider the complex number i. Select all numbers equivalent to -1. A. iB. -i C. i ^2D. -i^2E. i^4 HURRY PLZZZZZZ 67. Which Russian ruler became known as "the Great," partly because of his victory over the Mongol invaders? (Pgs. 168-169) ________________ III What is the value of x?9557 sense this is an educational sight i thought i would take a second to explain how terrible the system is.lets start with the sexism and the ped. ophila that goes on under our noses in school-the school dresscode is sexist, dont even try to prove me wrong. every day girls have to wake up and think "can i wear this or will i be distracting the boys?" are you serious?? thats so absurd. how about instead of teaching girls to be ashamed of their bodys you teach boys how to respect that women have bodys and cant change it.next the stress school puts on you- you have at least 7 classes if you are in middle school are higher. yet your teachers seem not to care. they just spoon feed you all these assignments with a due date they dont care about your extra hobbys, or your other classes. they say a single teacher cant teach all the subjects but expect students to learn them all?next the food.-if you can i would highly recommend packing a lunch because not only are schools not vegetarian friendly they are also totally unhealthy. studys show over 21% of kids in america get hospitalized from school food.lastly lets talk about the mental health/drama the school doesnt give a heck about- we all have school counselers, and people say they are there to help us but i know people who arent aloud to go to student services anymore for talking about their mental health issues "to much" and may i add the advice they give you is trash. "keep your head up" yea thats not gonna do anything. and not to mention drama. we all have drama at school at some point in life and all i hear is "stAy away from it" thats way easier said than done. borderline school is toxic. Why is Zora Neale Hurston important to American literature? In the number below, the underlined number represents how much more than the place value two spaces to its right?1.4263A1000 timesB100 times10 timesD2 times What is -2(x + 3) simplified using distributive property?Please help me!! 16. According to the fossil record, when did the first modern humans evolve? Which statement best explains why the Exodus is an important event in the Jewish religion? When the dilation has a scale factor greater than 1, it is considered an _____ A. enlargement B. reduction translate "it is one o'clock" in spanish How many years have passed since Odysseus first left Ithaca to the point at which he leaves Ogygia?7 years10 years14 years17 years 1.A gas sample has a volume of 300.0 L when under a pressure of 55.0 kPa. What is the new volume if thepressure is increased to 165 kPa while the temperature is held constant? A $950 deposit for 18 years compounded atan annual interest rate of 2.21% What is the circumference of the following circle? d=4 Which expression is equivalent to the following complex fraction 2-1/y/3+1y In a survey of 130 randomly selected students at a school, 30% of them said that math was their favorite subject. If there are 850 students in the school, how many students would choose math as their favorite subject? what is a theme in nothing Gold can stay by Robert frost Can someone answer this, please? Solve the proportion by using cross products.