1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lions [1.4K]
3 years ago
7

Suppose we can buy a chocolate bar from the vending machine for $1 each. Inside every chocolate bar is a coupon. We can redeem s

ix coupons for one chocolate bar from the machine. This means that once you have started buying chocolate bars from the machine, you always have some coupons. We would like to know how many chocolate bars can be eaten if we start with N dollars and always redeem coupons if we have enough for an additional chocolate bar.For example, with 6 dollars we could consume 7 chocolate bars after purchasing 6 bars giving us 6 coupons and then redeeming the 6 coupons for one bar. This would leave us with one extra coupon. For 11 dollars, we could consume 13 chocolate bars and still have one coupon left. For 2 dollars, we could have consumed 14 chocolate bars and have two coupons left.Write a program that inputs a value for N and outputs how many chocolate bars we can eat and how many coupons we would have left over. Use a loop that continues to redeem coupons as long as there are enough to get at least one chocolate bar.
Computers and Technology
1 answer:
Tanya [424]3 years ago
7 0

Answer and Explanation:

Using JavaScript:

/* program should take N input which represents the dollar amount and output how many chocolate bars and how many coupons we have*/

function chocolatebar(dollars){

var dollaramt= dollars;

var i;

for(i=0; i <= dollaramt; i++){

i=i+6

?

Alert ("you have 1 extra chocolate bar");

:

Alert ("keep buying chocolate bars to get more coupons for a bonus chocolate bar")

}

}

*

You might be interested in
List three ways of breaking a copyright law with the illegal copy of software.​
erma4kov [3.2K]

Answer:

  • Using it
  • Selling it
  • Giving it to someone.

Explanation:

Copyright law protects the unauthorized access to, reproduction and distribution of copyrighted material. The permission of the copyright holders is needed if any of these are to be done.

If copyrighted material is used without permission such as using software without buying it, that is illegal. If that software is sold or given to someone else, that is also illegal because it can only be distributed or redistributed by the copyright owners or people they have given access to.

4 0
3 years ago
Should the use of hacktivists by a country against enemy organizations be considered an act of war? Why or why not? How about th
Artyom0805 [142]

Explanation:

Hacktivist comes from the combination of two words --- "Hack" and " Activism" .

Hacktivist perform hacktivism that means they make use of technology and knowledge to support as well as promote the political agenda and any kind of change in the social event.

Cyberterrorism, on the other hand uses internet and technology and conduct terrorism and other anti national activities like to coerce the societies or the governments in pursuit of their goals which are  religious, ideological or political.

While Hacktivism is used for a political cause, and is done in a peaceful manner; whereas cyber terrorism tries to grab the attention of the public through their aggressive ways, specifically by putting fear among the public.

But there is no instance of any person of getting killed by a cyber-attack or cyber terrorism. The larger damage is however done by those viruses or malware which gets into other persons computers or enemy organization computer system and weakens them and steals information and data. They damage and harm the economy in a larger scale.

When Chinese government first introduced the Trojan virus on the computer systems of their opponents abroad, is that can be called as Hacktivism? In  essence, this act may be called as cyber terrorism and not hacktivism. Because the Chinese Government intend to cause major economic damage and harm to their opponents or enemy organization by targeting the software giants in the West.

These companies crashed and and many left jobless and unemployment, they caused economic problems and damage to the technologies.  However, the Chinese Government's perspective on this is that they addresses such a thing as hacktivism as it advocates the state censorship by filtering the politically or the socially-unacceptable ideas in their e-mail.

Thus, the answer is relative as to whose perspective we are looking. Either we are taking the perspective of the Chinese government or that of the enemy organization which is affected by the act of the state censorship and targeting the Western software giants.

Cyberterrorism will somehow become a serious threat to the society when people adept at hacking will sympathize and also align with terrorists activities and cause. It has become appealing since some of computer programs have the features that are easily exploited and conducive for committing cyber terrorism.

3 0
3 years ago
Write a public static method called getPIDs that has a parameter of type Map called nameToPID (keys are student names and values
Rasek [7]

Answer:

Java program is explained below

Explanation:

import java.util.HashSet;

import java.util.Map;

import java.util.TreeMap;

public class TruckRace1 {

   public static HashSet<String> getPIDs (Map<String,String>nameToPID ){

       HashSet<String> pidSet = new HashSet<>();

       for(String ids: nameToPID.values()){

           pidSet.add(ids);

       }

       return pidSet;

   }

   public static void main(String[] args) {

       Map<String,String> pids = new TreeMap<>();

       pids.put("John","123");

       pids.put("Jason","124");

       pids.put("Peter","125");

       pids.put("Alice","126");

       pids.put("Peny","129");

       HashSet<String> ids = getPIDs(pids);

       for(String id:ids){

           System.out.println(id);

       }

   }

}

4 0
3 years ago
Match the term with the appropriate definitions : Edge Computer Applications ANSWERED
WARRIOR [948]
It’s right, good luck.
7 0
1 year ago
a customer is looking for efficient alert management for its Data centre operations for reducing human effort in monitoring and
MAXImum [283]

Answer:Yes !

Explanation:  I totally agree, he really is looking !

8 0
2 years ago
Other questions:
  • Which principle of design is she following
    9·1 answer
  • Radiation requires a heated liquid to transfer energy. Please select the best answer from the choices provided T F
    10·2 answers
  • Infrared, a wireless connection used in the past prior to bluetooth, was limited because it ________.
    10·1 answer
  • How can a network design project benefit from the principles of itsm? How might itsm impede a network design project?
    11·1 answer
  • Which two statements are true about the Data Sync functionality? (Choose two.)
    15·1 answer
  • The largest type of computer system with the most extensive storage capacity and the fastest processing speeds is a ________.
    7·1 answer
  • Which one of these is correct PI of a XML document?
    13·1 answer
  • Which data type can store decimal or fractional numbers?
    15·2 answers
  • Who is the best nfl team in your mind
    14·2 answers
  • Which of the following described a global network connecting billions of computers and other
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!