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
Mama L [17]
3 years ago
13

(Java) Meadowdale Dairy Farm sells organic brown eggs to local customers. It charges $3.25 for a dozen eggs, or 45 cents for ind

ividual eggs that are not part of a dozen. Write a program that prompts a user for the number of eggs in the order and then display the amount owed with a full explanation using the following wording: You ordered 27 eggs. That’s 2 dozen at $3.25 per dozen and 3 loose eggs at 45 cents each for a total of $7.85.
import java.util.Scanner;
class Eggs {
public static void main(String[] args) {
// Write your code here

}
}​
Computers and Technology
1 answer:
zepelin [54]3 years ago
8 0

import java.util.Scanner;

public class Eggs {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("How many eggs?");

       int eggs = scan.nextInt();

       int dozens = eggs / 12, ind = eggs - (dozens*12);

       

       System.out.println("You ordered "+eggs+" eggs. That's "+dozens+" at $3.25 per dozen and "+ind+" loose eggs at 45 cents each for a total of $"+((dozens*3.25)+(ind*0.45))+".");

   }

   

}

I hope this helps!

You might be interested in
* Declare a variable called "race" of type "Race", andinitialise its value to a new instance of the "Race" class. The"Race" cons
goldfiish [28.3K]

Answer:

Race race = new Race(track, car);

Explanation:

Complete code fragment is as follows:

Track track = new Track();

Car car = mycar;

Race race = new Race(track,car);

Here we are declaring a variable race of the type Race  which is initialized to new instance of Race class. The constructor of race takes up the following 2 arguments:

1) New Instance of Track class;

2) Previously defined reference to an object of type Car.

4 0
4 years ago
Help please will give brainliest!!!!!!!!!
Shkiper50 [21]

Answer:

Take a String.

Convert it into array of characters.

Apply for loop till length of char array.

Using isDigit() method we can check the digits in string.

If isDigit() will return true then print that index value.

That digit is in char form. ...

Using sum variable, we will sum it.

Explanation:

4 0
2 years ago
What subsection of the Internet requires specialized browser to access and is frequently used by cyber criminals and underground
kotykmax [81]

Answer:

c. Dark Web                                                

Explanation:

Surface web is also called visible web is a part of world wide web that can be easily searchable using search engines as its contents are indexed by the search engines such as Google and its contents are accessible by public using standard web browsers. So a is not a suitable choice.

Deep Web is called invisible web as it is not accessible or searchable to standard search engines like Google. Search engines cannot index the contents of these sites. However such sites do not requires specialized browsers to access. So b is not a suitable choice.

Dark Web: It is a part of Deep Web sites but it requires specialized software and browsers to access. These sites cannot be indexed and cannot be searchable through standard search engines. This is also called dark side of the world wide web darker which is frequently used by criminals, hackers, black markets, hit-men. Illegal activities on a massive level is takes place in the dark web such as access to stolen sensitive information, malware, drug trade and terrorist operations. These sites are temporary and keep changing addresses to lessen the risk of getting caught by govt agencies or security officials. So c is the suitable choice.

Crypto-Net is a kind of neural network which works with encrypted data which can make a prediction based on the data without disclosing the data and prediction to the 3rd party. So d is not a suitable option.

6 0
3 years ago
Can someone help me out with this one? I'm not sure why my code is not working
UNO [17]

Answer:

Add this statement at the end of your steps() function

return ""

This statement will not print None at the end of steps.

Explanation:

Here is the complete function with return statement added at the end:

def steps(number):  # function steps that takes number (number of steps to print) as parameter and prints the steps specified by number

   i = 1  #assigns 1 to i

   while i < number + 1:  

       string = str(i) * 3  #multiplies value of i by 3 after converting i to string

       string1 = str(string)  # stores the step pattern to string1

       if i != 0:  # if the value of i is not equal to 0

           string1 = (i * 4*' ' + "\b" + "\b" + "\b" + "\b") + string  #set the spaces between steps

       elif i == 1:  # if value of i is equal to 1

           string1 = string  #set the string to string1

       print(string1)  # print string1

       i = i + 1  # increments i at each iteration

   return "" #this will not print None at the end of the steps and just add a an empty line instead of None.

Screenshot of the corrected program along with its output is attached.

5 0
4 years ago
Write a program that asks the user for a word. Next, open up the movie reviews.txt file and examine every review one at a time.
Hatshy [7]

Answer:

import numpy as np

word = input("Enter a word: ")

acc = []

with open("Downloads/record-collection.txt", "r") as file:

   lines = file.readlines()

   for line in lines:

       if word in line:

           line = line.strip()

           acc.append(int(line[0]))

   if np.mean(acc) >= 2:

       print(f"The word {word} is a positive word")

       print(f"{word} appeared {len(acc)} times")

       print(f"the review of the word {word} is {round(np.mean(acc), 2)}")

   else:

       print(f"the word {word} is a negative word with review\

{round(np.mean(acc), 2)}")

Explanation:

The python program gets the text from the review file, using the user input word to get the definition of reviews based on the word, whether positive or negative.

The program uses the 'with' keyword to open the file and created the acc variable to hold the reviews gotten. The mean of the acc is calculated with the numpy mean method and if the mean is equal to or greater than 2 it is a positive word, else negative.

5 0
3 years ago
Other questions:
  • 2. To learn the proper way to set up a table of contents, editors can use a A. style manual. B. dictionary. C. grammar checker.
    15·1 answer
  • Which of the following refers to rules written by an organization or entity to guide behavior in a particular setting or situati
    7·2 answers
  • Data ____________ refers to any technique that recodes the data in a file so that it contains fewer bits.​
    10·1 answer
  • Who are the founders of Microsoft?
    5·1 answer
  • Consider five wireless stations, A, B, C, D, and E.
    13·1 answer
  • Write a program that asks the user to enter the size of a triangle (an integer from 1 to 50). Display the triangle by writing li
    15·1 answer
  • Pls help me with this pls
    7·2 answers
  • Malware is a combination of which two words? A. malevolent and software B. malignant and software C. maladapted and software D.
    8·1 answer
  • Import java.util.ArrayList;
    14·1 answer
  • ¿Qué algoritmos de encriptación utilizan una clave para cifrar los datos y una clave diferente para descifrarlos?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!