answer.
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
kenny6666
2 months ago
6

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

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. For example, typical output might be, 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. Save the program as Eggs.java.
Computers and Technology
1 answer:
ivann1987 [1K]2 months ago
7 0

Response:

Clarification:

import java.Util;

public class Eggs{

public static void main (String [] args)

{

int eggCount, dozens, remainingEggs;

float finalAmount;

Scanner scanner = new Scanner(System.in);

eggCount = scanner.nextInt();

if(eggCount < 0)

{

System.out.print("Invalid");

}

else

{

if(eggCount >= 12)

{

dozens = eggCount/12;

remainingEggs = eggCount % 12;

}

else

{

dozens = 0;

remainingEggs = eggCount;

}

finalAmount = dozens * 3.25 + (remainingEggs * 45)/100;

System.out.print("You have ordered "+eggCount+" eggs.\n");

System.out.print("This amounts to "+dozens+" dozen at $3.25 each and "+remainingEggs+" loose eggs at 45 cents each, totaling $"+finalAmount);

}

}

}

You might be interested in
The Coins class was created to hold all your loose change, kind of like a piggy bank! For this exercise, you are going to simula
Amiraneli [1052]

Answer:

Coins c1 = new Coins (4, 3, 2, 1);

c1.bankValue();

c1.addQuarter();

c1.addQuarter();

c1.addDime();

c1.addDime();

c1.addPenny();

c1.bankCount();

c1.bankValue();

Explanation:

8 0
1 month ago
Cloud Kicks is undergoing a GDPR-focused implementation to ensure access to personal information data is limited to only users w
Rzqust [1037]

Response:

Option A.

Clarification:

The organization is executing a GDPR-focused strategy to ensure that access to sensitive data is limited to only those users who genuinely need full rights to a corporate account. It utilizes a personalized account structure.

Thus, the Consultant provides specific Account permissions to the Renewals and Sales Operations teams, enabling them to establish roles for the Renewals and Sales Account teams, with sales team members matched to the respective customers.

5 0
1 month ago
c++ 2.30 LAB: Phone number breakdown Given a long long integer representing a 10-digit phone number, output the area code, prefi
oksian1 [950]

Answer:

#include <iostream>

using namespace std;

int main()

{

   // Declare variables to hold entire phone number and its components

   long phone_number;

   int area_code, prefix, line_number;

   cout << "Enter 10-digit phone number:" << endl;

   // Take 10-digit phone number input

   cin >> phone_number;

   // Extract area code, prefix, and line number

   area_code = phone_number / 10000000;

   prefix = (phone_number / 10000) % 1000;

   line_number = phone_number % 10000;

   // Output phone number in desired hyphen-separated format

   cout << area_code << "-" << prefix << "-" << line_number << endl;

   return 0;

}

Output:

Enter 10-digit phone number:

8005551212

800-555-1212

Explanation:

The program takes a 10-digit phone number input from the user and stores it in the variable phone_number.

Using division and modulus operations, it separates the phone number into three parts:

area_code = phone_number / 10000000;

prefix = (phone_number / 10000) % 1000;

line_number = phone_number % 10000;

Finally, the program prints these parts joined by hyphens.

5 0
3 months ago
Assume that a function named swapdoubles has been defined and is available for use in this exercise: that function receives two
Natasha_Volkova [1026]
The provided C++ code is designed to sort three double variables: void sort3(double &a, double &b, double &c). The logic within functions attempts to ensure that these values are ordered correctly, implementing swaps accordingly.
6 0
2 months ago
CHALLENGE ACTIVITY 2.15.1: Reading and outputting strings. Write a program that reads a person's first and last names, separated
Harlamova29_29 [1022]

Response:

#include <iostream>

using namespace std;

int main()

{

   string Fname, Lname;

   cout << "Please enter your first name " <<"Please enter your last name" <<endl;

   cin>>Fname>>Lname;

   cout<<Lname<<", "<<Fname<<endl;

   return 0;

}

Clarification:

This code is coded in the C++ programming language. To begin with, two string variables are declared, namely Fname and Lname for the first and last names, respectively. The C++ cout function is utilized to ask users for their inputs, while the cin function takes in user inputs and stores them in the corresponding variables. The cout operator (<<) arranges the output in accordance with the specification given in the question

8 0
2 months ago
Other questions:
  • Which of these is an example of the integrity principle that can ensure your data is accurate and untampered with?
    10·2 answers
  • An Internet user has a need to send private data to another user. Which of the following provides the most security when transmi
    14·2 answers
  • Create a different version of the program that: Takes a 3-digit number and generates a 6-digit number with the 3-digit number re
    14·1 answer
  • A client has macular degeneration resulting in moderate visual impairment. The client works as a data entry clerk and wants to c
    15·1 answer
  • How has the development of personal computer hardware and software reversed some of the trends brought on by the industrial revo
    15·1 answer
  • A wireless network was recently installed in a coffee shop and customer mobile devices are not receiving network configuration i
    12·1 answer
  • Assume that k corresponds to register $s0, n corresponds to register $s2 and the base of the array v is in $s1. What is the MIPS
    10·1 answer
  • When using preventative insecticides which holiday period should trigger an application?
    15·2 answers
  • Given positive integer n, write a for loop that outputs the even numbers from n down to 0. If n is odd, start with the next lowe
    8·1 answer
  • Given three dictionaries, associated with the variables, canadian_capitals, mexican_capitals, and us_capitals, that map province
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!