Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes

Answers

Answer 1

Answer:.

// Program is written in C++.

// Comments are used for explanatory purposes

// Program starts here..

#include<iostream>

using namespace std;

int main()

{

// Declare Variables

int amount, dollar, quarter, dime, nickel, penny;

// Prompt user for input

cout<<"Amount: ";

cin>>amount;

// Check if input is less than 1

if(amount<=0)

{

cout<<"No Change";

}

else

{

// Convert amount to various coins

dollar = amount/100;

amount = amount%100;

quarter = amount/25;

amount = amount%25;

dime = amount/10;

amount = amount%10;

nickel = amount/5;

penny = amount%5;

// Print results

if(dollar>=1)

{

if(dollar == 1)

{

cout<<dollar<<" dollar\n";

}

else

{

cout<<dollar<<" dollars\n";

}

}

if(quarter>=1)

{

if(quarter== 1)

{

cout<<quarter<<" quarter\n";

}

else

{

cout<<quarter<<" quarters\n";

}

}

if(dime>=1)

{

if(dime == 1)

{

cout<<dime<<" dime\n";

}

else

{

cout<<dime<<" dimes\n";

}

}

if(nickel>=1)

{

if(nickel == 1)

{

cout<<nickel<<" nickel\n";

}

else

{

cout<<nickel<<" nickels\n";

}

}

if(penny>=1)

{

if(penny == 1)

{

cout<<penny<<" penny\n";

}

else

{

cout<<penny<<" pennies\n";

}

}

}

return 0;

}


Related Questions

What do we call data that's broken down into bits and sent through a network?

Answers

Answer:

Bits

Explanation:

Dave owns a construction business and is in the process of buying a laptop. He is looking for a laptop with a hard drive that will likely continue to function if the computer is dropped. Which type of hard drive does he need?

Answers

Answer:

Solid state drive

Explanation:

The term solid-state drive is used for the electronic circuitry made entirely from semiconductors. This highlights the fact that the main storage form, in terms of a solid-state drive, is via semiconductors instead of a magnetic media for example a hard disk.  In lieu of a more conventional hard drive, SSD is built to live inside the device. SSDs are usually more resistant to physical shock in comparison to the electro-mechanical drives and it functions quietly and has faster response time. Therefore,  SSD will be best suitable for the Dave.

Create a program that generates a report that displays a list of students, classes they are enrolled in and the professor who teaches that class. There are 3 files that provide the input data: 1. FinalRoster.txt : List of students and professors ( S: student, P: professor) Student row: S,Student Name, StudentID Professor row: P, Professor Name, Professor ID, Highest Education 2. FinalClassList.txt: List of classes and professor who teach them (ClassID, ClassName, ID of Professor who teach that class) 3. FinalStudentClassList.txt: List of classes the students are enrolled in. (StudentID, ClassID) The output shall be displayed on screen and stored in a file in the format described in FinalOutput.txt You will need to apply all course concepts in your solution. 1. Student and Professor should be derived from a super class "Person" 2. Every class should implement toString method to return data in the format required for output 3. Exception handling (e.g. FileNotFound etc.) must be implemented 4. Source code must be documented in JavaDoc format 5. Do not hard code number of students, professors or classes. Submit source Java files, the output file and screenshot of the output in a zip format

Answers

Answer:

All the classes are mentioned with code and screenshots. . That class is shown at last.

Explanation:

Solution

Class.Java:

Code

**

* atauthor your_name

* This class denotes Class at the college.

*

*/

public class Class {

 

  private String className,classID;

  private Professor professor;

 

  /**

  * atparam className

  * atparam classID

  * atparam professor

  */

  public Class(String className, String classID, Professor professor) {

      this.classID=classID;

      this.className=className;

      this.professor=professor;

  }

     /**

  * at return classID of the class

  */

  public String getClassID() {

      return classID;

  }

    /**

  * Override toString() from Object Class

  */

  public String toString() {    

      return classID+" "+className+" "+professor.getName()+" "+professor.getEducation();        

  }  

}

Person.Java:

Code:

/**

* atauthor your_name

* This class represents Person

*

*/

public class Person {    

  protected String name;  

  /**method to fetch name

  * at return

  */

  public String getName() {

      return name;

  }

  /**method to set name

  * at param name

  */

  public void setName(String name) {

      this.name = name;

  }

Professor.java:

Code:

import java.util.ArrayList;

import java.util.List;  

/**

* at author your_name

*

*This class represents professors

*

*/

public class Professor extends Person{    

  private String professorID, education;

  private List<Class> classes=new ArrayList<Class>();    

  /**

  * at param name

  * at param professorID

  * at param education

  */

  public Professor(String name,String professorID,String education) {        

      this.name=name;

      this.professorID=professorID;

      this.education=education;        

  }

  /**

  * at return

  */

  public String getEducation() {

      return this.education;

  }    

  /**

  * at return

  */

  public String getprofessorID() {

      return this.professorID;

  }  

  /** to add classes

  * at param Class

  */

  public void addClass(Class c) {

      classes.add(c);

  }  

  /**

  * Override toString() from Object Class

  */

  public String toString() {

      String result=this.getName()+" - "+professorID+" - "+education;

      for(Class c:classes) {

          result+=c.toString()+"\n";

      }      

      return result;

  }

}

}

Student.java:

Code:

import java.util.ArrayList;

import java.util.List;  

/**

* This class represents students

*  at author your_Name

*

*/

public class Student extends Person{    

  private String studentID;

  private List<Class> classes=new ArrayList<Class>();    

  /**

  * atparam name

  * atparam studentID

  */

  public Student(String name,String studentID) {      

      this.name=name;

      this.studentID=studentID;      

  }  

  /**

  * atreturn

  */

  public String getStudentID() {

      return studentID;

  }

     /**

  * atparam c

  */

  public void addClass(Class c) {

      classes.add(c);

  }    

  /**

  * atreturn

  */

  public int getClassCount() {

      return classes.size();

  }

  /**

  * Override toString() from Object Class

  */

  public String toString() {

      String result=this.getName()+" - "+studentID+"\n";

      for(Class c:classes) {

          result+=c.toString()+"\n";

      }    

      return result;

  }  

}

NOTE: Kindly find an attached copy of screenshot of the output, which is a part of the solution to this question

Describe the Software Development Life Cycle. Describe for each phase of the SDLC how it can be used to create software for an Employee Payroll System that allows employees to log the number of hours completed in a work period and then generate their pay. Use Microsoft Word to complete this part of the assessment. Save your file as LASTNAME FIRSTNAME M08FINAL1 were LASTNAME is your lastname and FIRSTNAME is your first name. Upload your answer to this question; do not submit this assessment until you have completed all questions. This question is worth 25 points.

Answers

Answer:

Check the explanation

Explanation:

SDLC

SDLC stands for Software Development Life Cycle

It provides steps for developing a software product

It also checks for the quality and correctness of a software

The main aim of SDLC is to develop a software, which meets a customer requirements

SDLC involves various phases to develop a high-quality product for its end user

Phases of SDLC

           There are seven phases in a software development life cycle as follows,

Requirement Analysis   Feasibility Study   Design    Coding    Testing Deployment      Maintenance

kindly check the attached image below

Requirement analysis

This is the first stage in a SDLC.

In this phase, a detailed and precise requirements are collected from various teams by senior team members

It gives a clear idea of the entire project scope, opportunities and upcoming issues in a project

This phase also involves, planning assurance requirements and analyze risk involved in the project

Here, the timeline to finish the project is finalized

Feasibility Study

In this stage, the SRS document, that is “Software Requirement Specification” document is defined, which includes everything to be designed and developed during the life cycle of a project

Design

In this phase as the name indicates, software and system design documents are prepared, based on the requirement specification document

This enable us to define the whole system architecture

Two types of design documents are prepared in this phase as follows,

High-Level Design

Low-Level Design

Coding

In this phase, the coding of project is done in a selected programming language

Tasks are divided into many units and given to various developers

It is the longest phase in the SDLC

Testing

In this stage, the developed coding is tested by the testing team

The testing team, checks the coding in the user point of view

Installation/Deployment

In this stage, a product is released by the company to the client

Maintenance

Once the product is delivered to the client, the maintenance phase work will start by fixing errors, modifying and enhancing the product.

Employee Payroll System

Requirement analysis

Gather information from various team for requirement

Analyze the number of employees to handle the project

Timeline to finish the project, eg.1 month

Feasibility Study

The system requirements such as how many systems are required

Decide which software to be installed to handle the project.

For example, if we are going to develop the software using C language, then software for that has to be installed

The SRS document has to be prepared

Design

In this the HLD and LLD is prepared, the overall software architecture is prepared

The modules involved in coding are decided

Here the modules can be employee, payroll manager, Employee Log time, account details

The input and output are designed, such as employee name is the input and output is the salary for him, based on working hours

Coding

Here the coding is divided into various sections and given to 2 or more employees

One may code employee detail, one will code working hours of employees and one may code the banking details of employee

Testing

The coding is tested for syntax, declaration, data types and various kinds of error

The testing team will test the coding with various possible values

They may even check with wrong values and analyze the output for that

Installation

Now the software is installed in the client system and the client is calculating the payroll for an employee based on working hours in a month

Maintenance

If any error occurs, the team will clear the issue.

When a new employee joins, then the employee data will added to the database and the database is updated

Also if the client asks for any new features, it will done in this phase.

Which of the following is an example of the rewards & consequences characteristic of an organization?
OOO
pay raise
time sheets
pay check
pay scale

Answers

Answer:

Pay raise is an example of the rewards & consequences characteristic of an organization.

I think its pay rase?

4. Write an interface ObjectWithTwoParameters which has a method specification: double area (double d1, double d2) which returns the area of a particular object. Write three classes RectangleClass, TriangleClass, and CylinderClass which implement the interface you created. Also, write a demo class which creates objects of RectangleClass, TriangleClass, and CylinderClass and call the corresponding methods

Answers

Answer:

The java program for the given scenario is as follows.

import java.util.*;

//interface with method area

interface ObjectWithTwoParameters

{

double area (double d1, double d2);

}

class RectangleClass implements ObjectWithTwoParameters

{

//overriding area()

public double area (double d1, double d2)

{

return d1*d2;

}

}

class TriangleClass implements ObjectWithTwoParameters

{

//overriding area()

public double area (double d1, double d2)

{

return (d1*d2)/2;

}  

}

class CylinderClass implements ObjectWithTwoParameters

{

public double area (double d1, double d2)

{

return ( 2*3.14*d1*d1 + d2*(2*3.14*d1) );

}

}

public class Test

{

public static void main(String[] args)

{

//area displayed for all three shapes

ObjectWithTwoParameters r = new RectangleClass();

double arear = r.area(2, 3);

System.out.println("Area of rectangle: "+arear);

ObjectWithTwoParameters t = new TriangleClass();

double areat = t.area(4,5);

System.out.println("Area of triangle: "+areat);

ObjectWithTwoParameters c = new CylinderClass();

double areac = c.area(6,7);

System.out.println("Area of cylinder: "+areac);

}

}

OUTPUT

Area of rectangle: 6.0

Area of triangle: 10.0

Area of cylinder: 489.84

Explanation:

1. The program fulfils all the mentioned requirements.

2. The program contains one interface, ObjectWithTwoParameters, three classes which implement that interface, RectangleClass, TriangleClass and CylinderClass, and one demo class, Test, containing the main method.

3. The method in the interface has no access specifier.

4. The overridden methods in the three classes have public access specifier.

5. No additional variables have been declared.

6. The test class having the main() method is declared public.

7. The area of the rectangle, triangle and the cylinder have been computed as per the respective formulae.

8. The interface is similar to a class which can have only declarations of both, variables and methods. No method can be defined inside an interface.

9. The other classes use the methods of the interface by implementing the interface using the keyword, implements.

10. The object is created using the name of the interface as shown.

ObjectWithTwoParameters r = new RectangleClass();

What is blue L.E.D. light

Answers

The invention of blue LEDs meant that blue, red, and green could all be combined to produce white LED light, which can function as an alternative energy-saving light source.
A blue led light is just a the color blue with the LED strips

How has the Aswan High Dem had an adverse effect on human health?​

Answers

Answer:

How was the Aswan high dam had an adverse effect on human health? It created new ecosystems in which diseases such as malaria flourished. An environmental challenge facing the Great Man Made River is that pumping water near the coast. ... Water scarcity makes it impossible to grow enough food for the population.

Explanation:

In this lab, you use the flowchart and pseudocode found in the figures below to add code to a partially created C++ program. When completed, college admissions officers should be able to use the C++ program to determine whether to accept or reject a student, based on his or her test score and class rank.

// HouseSign.cpp - This program calculates prices for custom made signs.

#include
#include
using namespace std;
int main()
{
// This is the work done in the housekeeping() function
// Declare and initialize variables here
// Charge for this sign
// Color of characters in sign
// Number of characters in sign
// Type of wood

// This is the work done in the detailLoop() function
// Write assignment and if statements here

// This is the work done in the endOfJob() function
// Output charge for this sign
cout << "The charge for this sign is $" << charge << endl;
return(0);
}

Answers

Here is the complete question.

In this lab, you use the flowchart and pseudocode found in the figures below to add code to a partially created C++ program. When completed, college admissions officers should be able to use the C++ program to determine whether to accept or reject a student, based on his or her test score and class rank.

start input testScore,

classRank if testScore >= 90 then if classRank >= 25 then output "Accept"

else output "Reject" endif else if testScore >= 80

then if classRank >= 50 then output "Accept" else output "Reject" endif

else if testScore >= 70

then if classRank >= 75 then output "Accept"

else output "Reject"

endif else output "Reject"

endif

endif

endif

stop

Study the pseudocode in picture above. Write the interactive input statements to retrieve: A student’s test score (testScore) A student's class rank (classRank) The rest of the program is written for you. Execute the program by clicking "Run Code." Enter 87 for the test score and 60 for the class rank. Execute the program by entering 60 for the test score and 87 for the class rank.

[comment]: <> (3. Write the statements to convert the string representation of a student’s test score and class rank to the integer data type (testScore and classRank, respectively).)

Function: This program determines if a student will be admitted or rejected. Input: Interactive Output: Accept or Reject

*/ #include using namespace std; int main() { // Declare variables

// Prompt for and get user input

// Test using admission requirements and print Accept or Reject

if(testScore >= 90)

{ if(classRank >= 25)

{ cout << "Accept" << endl; }

else

cout << "Reject" << endl; }

else { if(testScore >= 80)

{ if(classRank >= 50)

cout << "Accept" << endl;

else cout << "Reject" << endl; }

else { if(testScore >= 70)

{ if(classRank >=75) cout << "Accept" << endl;

else cout << "Reject" << endl; }

else cout << "Reject" << endl; } } } //End of main() function

Answer:

Explanation:

The objective here is to use the flowchart and pseudocode found in the figures below to add code to a partially created C++ program. When completed, college admissions officers should be able to use the C++ program to determine whether to accept or reject a student, based on his or her test score and class rank.

PROGRAM:

#include<iostream>

using namespace std;

int main(){

// Declare variables

int testScore, classRank;

// Prompt for and get user input

cout<<"Enter test score: ";

cin>>testScore;

cout<<"Enter class rank: ";

cin>>classRank;

// Test using admission requirements and print Accept or Reject

if(testScore >= 90)  

{ if(classRank >= 25)

{ cout << "Accept" << endl; }

else

cout << "Reject" << endl;

}

else { if(testScore >= 80)

{ if(classRank >= 50)

cout << "Accept" << endl;

else cout << "Reject" << endl; }

else { if(testScore >= 70)

{ if(classRank >=75) cout << "Accept" << endl;

else cout << "Reject" << endl;

}

else cout << "Reject" << endl; }

}

return 0;

} //End of main() function

OUTPUT:

See the attached file below:


3.34 LAB: Mad Lib - loops in C++

Mad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (and hopefully funny) ways.

Write a program that takes a string and integer as input, and outputs a sentence using those items as below. The program repeats until the input is quit 0.

Ex: If the input is:
apples 5
shoes 2
quit 0

the output is:
Eating 5 apples a day keeps the doctor away.
Eating 2 shoes a day keeps the doctor away.

Make sure your answer is in C++.

Answers

Answer:

A Program was written to carry out some set activities. below is the code program in C++ in the explanation section

Explanation:

Solution

CODE

#include <iostream>

using namespace std;

int main() {

string name; // variables

int number;

cin >> name >> number; // taking user input

while(number != 0)

{

// printing output

cout << "Eating " << number << " " << name << " a day keeps the doctor away." << endl;

// taking user input again

cin >> name >> number;

}

}

Note: Kindly find an attached copy of the compiled program output to this question.

In this exercise we have to use the knowledge in computational language in C++ to describe a code that best suits, so we have:

The code can be found in the attached image.

What is looping in programming?

In a very summarized way, we can describe the loop or looping in software as an instruction that keeps repeating itself until a certain condition is met.

To make it simpler we can write this code as:

#include <iostream>

using namespace std;

int main() {

string name; // variables

int number;

cin >> name >> number; // taking user input

while(number != 0)

{

// printing output

cout << "Eating " << number << " " << name << " a day keeps the doctor away." << endl;

// taking user input again

cin >> name >> number;

}

}

See more about C++ at brainly.com/question/19705654

Write a program named RectangleArea to calculate the area of a rectangle with a length of 15.8 and a width of 7.9. The program should have two classes, one is the RectangleArea holding the Main(), and the other one is Rectangle. The Rectangle class has three members: a property of length, a property of width, and a method with a name of CalArea() to calculate the area. You can invoke the auto-provided constructor or write a self-defined constructor to initialize the rectangle. Calculate and display the area of the rectangle by first initialize an object named myRectangle and then calculate its area using the CalArea() method.

Answers

Answer:

public class RectangleArea {

   public static void main(String[] args) {

       Rectangle myRectangle = new Rectangle(15.8, 7.9);

       double calArea = myRectangle.calcArea(15.8, 7.9);

       System.out.println("The area is "+ calArea);

   }

}

class Rectangle{

   private double length;

   private double width;

   //Defined Constructor

   public Rectangle(double length, double width) {

       this.length = length;

       this.width = width;

   }

   public double calcArea(double len, double wi){

       return len* wi;

   }

}

Explanation:

This is solved with Java programming languageStart by creating both classes RectangleArea and and RectangleSInce both classes are in the same file, only one can be publicClass Rectangle contains the three members are decribed by the questionprivate double length, private double width and the method calcArea(). It also has a sefl-declared constructor.In the class RectangleArea, an object of Rectangle is created and initialized.The method calcArea is called using the created object and the value is printed.

Caches are important to providing a high-performance memory hierarchy to processors. Below is a list of 32-bits memory address references given as word addresses. 0x03, 0xb4, 0x2b, 0x02, 0xbf, 0x58, 0xbe, 0x0e, 0xb5, 0x2c, 0xba, 0xfd For each of these references identify the binary word address, the tag, and the index given a direct mapped cache with 16 one-word blocks. Also list whether each reference is a hit or a miss, assuming the cache is initially empty.

Answers

Answer:

See explaination

Explanation:

please kindly see attachment for the step by step solution of the given problem.

How we can earn from an app​

Answers

Answer:

Hewo, Here are some ways in which apps earn money :-

AdvertisementSubscriptionsIn-App purchasesMerchandisePhysical purchasesSponsorship

hope it helps!

This represents a group of Book values as a list (named books). We can then dig through this list for useful information and calculations by calling the methods we're going to implement. class Library: Define the Library class. • def __init__(self): Library constructor. Create the only instance variable, a list named books, and initialize it to an empty list. This means that we can only create an empty Library and then add items to it later on.

Answers

Answer:

class Library:      def __init__(self):        self.books = [] lib1 = Library()lib1.books.append("Biology") lib1.books.append("Python Programming Cookbook")

Explanation:

The solution code is written in Python 3.

Firstly, we can create a Library class with one constructor (Line 2). This constructor won't take any input parameter value. There is only one instance variable, books, in the class (Line 3). This instance variable is an empty list.

To test our class, we can create an object lib1 (Line 5).  Next use that object to add the book item to the books list in the object (Line 6-8).  

Consider the following relations:
Emp(eid: integer, ename: varchar, sal: integer, age: integer, did: integer) Dept(did: integer, budget: integer, floor: integer, mgr_eid: integer) Salaries range from $10,000 to $100,000, ages vary from 20 to 80, each department has about five employees on average, there are 10 floors, and budgets vary from $10,000 to $1 million. You can assume uniform distributions of values. For each of the following queries, which of the listed index choices would you choose to speed up the query.
1. Query: Print ename, age, and sal for all employees.
A) Clustered hash index on fields of Emp.
B) Unclustered hash index on fields of Emp.
C) Clustered B+ tree index on fields of Emp.
D) Unclustered hash index on fields of Emp.
E) No index.
2. Query: Find the dids of departments that are on the 10th floor and have a budget of less than $15,000.
A) Clustered hash index on the floor field of Dept.
B) Unclustered hash index on the floor field of Dept.
C) Clustered B+ tree index on fields of Dept.
D) Clustered B+ tree index on the budget field of Dept.
E) No index.

Answers

Answer:

Check the explanation

Explanation:

--Query 1)

SELECT ename, sal, age

FROM Emp;

--Query 2)

SELECT did

FROM Dept

WHERE floot = 10 AND budget<15000;

Write a program to read as many test scores as the user wants from the keyboard (assuming at most 50 scores). Print the scores in (1) original order, (2) sorted from high to low (3) the highest score, (4) the lowest score, and (5) the average of the scores. Implement the following functions using the given function prototypes: void displayArray(int array[], int size) - Displays the content of the array void selectionSort(int array[], int size) - sorts the array using the selection sort algorithm in descending order. Hint: refer to example 8-5 in the textbook. int findMax(int array[], int size) - finds and returns the highest element of the array int findMin(int array[], int size) - finds and returns the lowest element of the array double findAvg(int array[], int size) - finds and returns the average of the elements of the array

Answers

Answer: Provided in the explanation segment

Explanation:

Below is the code to carry out this program;

/* C++ program helps prompts user to enter the size of the array. To display the array elements, sorts the data from highest to lowest, print the lowest, highest and average value. */

//main.cpp

//include header files

#include<iostream>

#include<iomanip>

using namespace std;

//function prototypes

void displayArray(int arr[], int size);

void selectionSort(int arr[], int size);

int findMax(int arr[], int size);

int findMin(int arr[], int size);

double findAvg(int arr[], int size) ;

//main function

int main()

{

  const int max=50;

  int size;

  int data[max];

  cout<<"Enter # of scores :";

  //Read size

  cin>>size;

  /*Read user data values from user*/

  for(int index=0;index<size;index++)

  {

      cout<<"Score ["<<(index+1)<<"]: ";

      cin>>data[index];

  }

  cout<<"(1) original order"<<endl;

  displayArray(data,size);

  cout<<"(2) sorted from high to low"<<endl;

  selectionSort(data,size);

  displayArray(data,size);

  cout<<"(3) Highest score : ";

  cout<<findMax(data,size)<<endl;

  cout<<"(4) Lowest score : ";

  cout<<findMin(data,size)<<endl;

  cout<<"(5) Lowest scoreAverage score : ";

  cout<<findAvg(data,size)<<endl;

  //pause program on console output

  system("pause");

  return 0;

}

 

/*Function findAvg that takes array and size and returns the average of the array.*/

double findAvg(int arr[], int size)

{

  double total=0;

  for(int index=0;index<size;index++)

  {

      total=total+arr[index];

  }

  return total/size;

}

/*Function that sorts the array from high to low order*/

void selectionSort(int arr[], int size)

{

  int n = size;

  for (int i = 0; i < n-1; i++)

  {

      int minIndex = i;

      for (int j = i+1; j < n; j++)

          if (arr[j] > arr[minIndex])

              minIndex = j;

      int temp = arr[minIndex];

      arr[minIndex] = arr[i];

      arr[i] = temp;

  }

}

/*Function that display the array values */

void displayArray(int arr[], int size)

{

  for(int index=0;index<size;index++)

  {

      cout<<setw(4)<<arr[index];

  }

  cout<<endl;

}

/*Function that finds the maximum array elements */

int findMax(int arr[], int size)

{

  int max=arr[0];

  for(int index=1;index<size;index++)

      if(arr[index]>max)

          max=arr[index];

  return max;

}

/*Function that finds the minimum array elements */

int findMin(int arr[], int size)

{

  int min=arr[0];

  for(int index=1;index<size;index++)

      if(arr[index]<min)

          min=arr[index];

  return min;

}

cheers i hope this help!!!

D-H public key exchange Please calculate the key for both Alice and Bob.
Alice Public area Bob
Alice and Bob publicly agree to make
N = 50, P = 41
Alice chooses her Bob
picks his
Private # A = 19 private #
B= ?
------------------------------------------------------------------------------------------------------------------------------------------
I am on Alice site, I choose my private # A = 19.
You are on Bob site, you pick up the private B, B and N should have no common factor, except 1.
(Suggest to choose B as a prime #) Please calculate all the steps, and find the key made by Alice and Bob.
The ppt file of D-H cryptography is uploaded. You can follow the steps listed in the ppt file.
Show all steps.

Answers

Answer:

See explaination

Explanation:

Please kindly check attachment for the step by step solution of the given problem.

Write an expression to detect that the first character of userinput matches firstLetter.

import java.util.Scanner; public class CharMatching { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); String userInput; char firstLetter; userInput = scnr.nextLine(); firstLetter = scnr.nextLine().charAt(0); if (/* Your solution goes here */) { System.out.println("Found match: " + firstLetter); } else { System.out.println("No match: " + firstLetter); } return; } }

Answers

Answer: Provided in the explanation segment

Explanation:

Below is the code to run this program.

we have that the

Program

import java.util.Scanner;

public class CharMatching {

  public static void main(String[] args) {

      //Scanner object for keyboard read

      Scanner scnr=new Scanner(System.in);

      //Variable for user input string

      String userInput;

      //Variable for firstletter input

      char firstLetter;

      //Read user input string

      userInput=scnr.nextLine();

      //Read first letter from user

      firstLetter=scnr.nextLine().charAt(0);

      //Comparison without case sensititvity and result

      if(Character.toUpperCase(firstLetter)==Character.toUpperCase(userInput.charAt(0))) {

          System.out.println("Found match: "+firstLetter);

      }

      else {

          System.out.println("No match: "+firstLetter);

      }

  }

}

Output

Hello

h

Found match: h

cheers i hope this helped !!!

Implement the function pairSum that takes as parameters a list of distinct integers and a target value n and prints the indices of all pairs of values in the list that sum up to n. If there are no pairs that sum up to n, the function should not print anything. Note that the function does not duplicate pairs of indices

Answers

Answer:

Following are the code to this question:

def pairSum(a,x): #find size of list

   s=len(a) # use length function to calculte length of list and store in s variable

   for x1 in range(0, s):  #outer loop to count all list value

       for x2 in range(x1+1, s):    #inner loop

           if a[x1] + a[x2] == x:    #condition check

               print(x1," ",x2) #print value of loop x1 and x2  

pairSum([12,7,8,6,1,13],13) #calling pairSum method

Output:

0   4

1   3

Explanation:

Description of the above python can be described as follows:

In the above code, a method pairSum is declared, which accepts two-parameter, which is "a and x". Inside the method "s" variable is declared that uses the "len" method, which stores the length of "a" in the "s" variable. In the next line, two for loop is declared, in the first loop, it counts all variable position, inside the loop another loop is used that calculates the next value and inside a condition is defined, that matches list and x variable value. if the condition is true it will print loop value.

The Taylor series expansion for ax is: Write a MATLAB program that determines ax using the Taylor series expansion. The program asks the user to type a value for x. Use a loop for adding the terms of the Taylor series. If cn is the nth term in the series, then the sum Sn of the n terms is . In each pass calculate the estimated error E given by . Stop adding terms when . The program displays the value of ax. Use the program to calculate: (a) 23.5 (b) 6.31.7 Compare the values with those obtained by using a calculator.

Answers

Answer: (a). 11.3137

(b). 22.849

Explanation:

Provided below is a step by step analysis to solving this problem

(a)

clc;close all;clear all;

a=2;x=3.5;

E=10;n=0;k=1;sn1=0;

while E >0.000001

cn=((log(a))^n)*(x^n)/factorial(n);

sn=sn1+cn;

E=abs((sn-sn1)/sn1);

sn1=sn;

n=n+1;

k=k+1;

end

fprintf('2^3.5 from tailor series=%6.4f after adding n=%d terms\n',sn,n);

2^3.5 from tailor series=11.3137 after adding n=15 terms

disp('2^3.5 using calculator =11.3137085');

Command window:

2^3.5 from tailor series=11.3137 after adding n=15 terms

2^3.5 using calculator =11.3137085

(b)

clc;close all;clear all;

a=6.3;x=1.7;

E=10;n=0;k=1;sn1=0;

while E >0.000001

cn=((log(a))^n)*(x^n)/factorial(n);

sn=sn1+cn;

E=abs((sn-sn1)/sn1);

sn1=sn;

n=n+1;

k=k+1;

end

fprintf('6.3^1.7 from tailor series=%6.4f after adding n=%d terms\n',sn,n);

disp('6.3^1.7 using calculator =22.84961748');

Command window:

6.3^1.7 from tailor series=22.8496 after adding n=16 terms

6.3^1.7 using calculator =22.84961748

cheers i hope this helped !!!

Assume the existence of an UNSORTED ARRAY of n characters. You are to trace the CS111Sort algorithm (as described here) to reorder the elements of a given array. The CS111Sort algorithm is an algorithm that combines the SelectionSort and the InsertionSort following the steps below: 1. Implement the SelectionSort Algorithm on the entire array for as many iterations as it takes to sort the array only to the point of ordering the elements so that the last n/2 elements are sorted in increasing (ascending) order. 2. Implement the InsertionSort Algorithm to sort the first half of the resulting array elements so that these elements are sorted in decreasing (descending) order.

Answers

Answer:

class Main {

  public static void main(String[] args) {

      char arr[] = {'T','E','D','R','W','B','S','V','A'};

      int n = arr.length;

      System.out.println("Selection Sort:");

      System.out.println("Iteration\tArray\tComparisons");

      long comp1 = selectionSort(arr);

      System.out.println("Total comparisons: "+comp1);

      System.out.println("\nInsertion Sort:");

      System.out.println("Iteration\tArray\tComparisons");

      long comp2 = insertionSort(arr);

      System.out.println("Total Comparisons: "+comp2);

      System.out.println("\nOverall Total Comparisons: "+(comp1+comp2));

  }

  static long selectionSort(char arr[]) {

      // applies selection sort for n/2 elements

      // returns number of comparisons

      int n = arr.length;

      long comparisons = 0;

 

      // One by one move boundary of unsorted subarray

      for (int i = n-1; i>=n-n/2; i--) {

              // Find the minimum element in unsorted array

              int max_idx = i;

              for (int j = i-1; j>=0; j--) {

                      // there is a comparison everytime this loop returns

                      comparisons++;

                      if (arr[j] > arr[max_idx])

                              max_idx = j;

              }

              // Swap the found minimum element with the first

              // element

              char temp = arr[max_idx];

              arr[max_idx] = arr[i];

              arr[i] = temp;

              System.out.print(n-1-i+"\t");

              printArray(arr);

              System.out.println("\t"+comparisons);

      }

     

      return comparisons;

  }

  static long insertionSort(char arr[]) {

      // applies insertion sort for n/2 elements

      // returns number of comparisons

      int n = arr.length;

      n = n-n/2;   // sort only the first n/2 elements

      long comparisons = 0;

      for (int i = 1; i < n; ++i) {

          char key = arr[i];

          int j = i - 1;

          /* Move elements of arr[0..i-1], that are

                  greater than key, to one position ahead

                  of their current position */

          while (j >= 0) {

              // there is a comparison everytime this loop runs

              comparisons++;

              if (arr[j] > key) {

                  arr[j + 1] = arr[j];

              } else {

                  break;

              }

              j--;

          }

          arr[j + 1] = key;

          System.out.print(i-1+"\t");

          printArray(arr);

          System.out.println("\t"+comparisons);

      }

      return comparisons;

  }  

  static void printArray(char arr[]) {

      for (int i=0; i<arr.length; i++)

          System.out.print(arr[i]+" ");

  }

}

Explanation:

Explanation is in the answer.

Write Scheme functions to do the following. You are only allowed to use the functions introduced in our lecture notes and the helper functions written by yourself. (a) Return all rotations of a given list. For example, (rotate ’(a b c d e)) should return ((a b c d e) (b c d e a) (c d e a b) (d e a b c) (e a b c d)) (in some order). (b) Return a list containing all elements of a given list that satisfy a given predicate. For example, (filter (lambda (x) (< x 5)) ’(3 9 5 8 2 4 7)) should return (3 2 4).

Answers

Answer:

Check the explanation

Explanation:

solution a:

def Rotate(string) :

n = len(string)

temp = string + string

for i in range(n) :

for j in range(n) :

print(temp[i + j], end = "")

print()

string = ("abcde")

Rotate(string)

solution b:

nums = [3,9,5,8,2,4,7]

res = list(filter(lambda n : n < 5, nums))

print(res)

g Create your own data file consisting of integer, double or String values. Create your own unique Java application to read all data from the file echoing the data to standard output. After all data has been read, display how many data were read. For example, if 10 integers were read, the application should display all 10 integers and at the end of the output, print "10 data values were read" Demonstrate your code compiles and runs without issue. Respond to other student postings by enhancing their code to write the summary output to a file instead of standard output.

Answers

Answer:

See explaination

Explanation:

//ReadFile.java

import java.io.File;

import java.io.FileNotFoundException;

import java.util.Scanner;

public class ReadFile

{

public static void main(String[] args)

{

int elementsCount=0;

//Create a File class object

File file=null;

Scanner fileScanner=null;

String fileName="sample.txt";

try

{

//Create an instance of File class

file=new File(fileName);

//create a scanner class object

fileScanner=new Scanner(file);

//read file elements until end of file

while (fileScanner.hasNext())

{

double value=fileScanner.nextInt();

elementsCount++;

}

//print smallest value

System.out.println(elementsCount+" data values are read");

}

//Catch the exception if file not found

catch (FileNotFoundException e)

{

System.out.println("File Not Found");

}

}

}

Sample output:

sample.txt

10

20

30

40

50

output:

5 data values are read

5.14 ◆ Write a version of the inner product procedure described in Problem 5.13 that uses 6 × 1 loop unrolling. For x86-64, our measurements of the unrolled version give a CPE of 1.07 for integer data but still 3.01 for both floating-point data. A. Explain why any (scalar) version of an inner product procedure running on an Intel Core i7 Haswell processor cannot achieve a CPE less than 1.00. B. Explain why the performance for floating-point data did not improve with loop unrolling.

Answers

Answer:

(a) the number of times the value is performs is up to four cycles. and as such the integer i is executed up to 5 times.  (b)The point version of the floating point can have CPE of 3.00, even when the multiplication operation required is either 4 or 5 clock.

Explanation:

Solution

The two floating point versions can have CPEs of 3.00, even though the multiplication operation demands either 4 or 5 clock cycles by the latency suggests the total number of clock cycles needed to work the actual operation, while issues time to specify the minimum number of cycles between operations.

Now,

sum = sum + udata[i] * vdata[i]

in this case, the value of i performs from 0 to 3.

Thus,

The value of sum is denoted as,

sum = ((((sum + udata[0] * vdata[0])+(udata[1] * vdata[1]))+( udata[2] * vdata[2]))+(udata[3] * vdata[3]))

Thus,

(A)The number of times the value is executed is up to 4 cycle. And the integer i performed up to 5 times.

Thus,

(B) The floating point version can have CPE of 3.00, even though the multiplication operation required either 4 or 5 clock.

For dinner, a restaurant allows you to choose either Menu Option A: five appetizers and three main dishes or Menu Option B: three appetizers and four main dishes. There are six kinds of appetizer on the menu and five kinds of main dish.

How many ways are there to select your menu, if...

a. You may not select the same kind of appetizer or main dish more than once.
b. You may select the same kind of appetizer and/or main dish more than once.
c. You may select the same kind of appetizer or main dish more than once, but not for all your choices, For example in Menu Option A, it would be OK to select four portions of 'oysters' and one portion of 'pot stickers', but not to select all five portions of 'oysters'.)

In each case show which formula or method you used to derive the result.

Answers

Answer:

The formula used in this question is called the probability of combinations or combination formula.

Explanation:

Solution

Given that:

Formula applied is stated as follows:

nCr = no of ways to choose r objects from n objects

  = n!/(r!*(n-r)!)

The Data given :

Menu A : 5 appetizers and 3 main dishes

Menu B : 3 appetizers and 4 main dishes

Total appetizers - 6

Total main dishes - 5

Now,

Part A :

Total ways = No of ways to select menu A + no of ways to select menu B

          = (no of ways to select appetizers in A)*(no of ways to select main dish in A) + (no of ways to select appetizers in B)*(no of ways to select main dish in B)

          = 6C5*5C3 + 6C3*5C4

          = 6*10 + 20*5

          = 160

Part B :

Since, we can select the same number of appetizers/main dish again so the number of ways to select appetizers/main dishes will be = (total appetizers/main dishes)^(no of appetizers/main dishes to be selected)

Total ways = No of ways to select menu A + no of ways to select menu B  

          = (no of ways to select appetizers in A)*(no of ways to select main dish in A) + (no of ways to select appetizers in B)*(no of ways to select main dish in B)

          = (6^5)*(5^3) + (6^3)*(5^4)

          = 7776*125 + 216*625

          = 1107000

Part C :

No of ways to select same appetizers and main dish for all the options

= No of ways to select menu A + no of ways to select menu B  

= (no of ways to select appetizers in A)*(no of ways to select main dish in A) + (no of ways to select appetizers in B)*(no of ways to select main dish in B)

=(6*5) + (6*5)

= 60

Total ways = Part B - (same appetizers and main dish selected)      

= 1107000 - 60

= 1106940

Write the interface (.h file) of a class Counter containing: A data member counter of type int. A data member named counterID of type int. A static int data member named nCounters. A constructor that takes an int argument. A function called increment that accepts no parameters and returns no value. A function called decrement that accepts no parameters and returns no value. A function called getValue that accepts no parameters and returns an int. A function named getCounterID that accepts no parameters and returns an int.

Answers

Explanation:

See the attached image for The interface (.h file) of a class Counter

(TCO 4) Give the contents of Register A after the execution of the following instructions:

Data_1 EQU $12
Data_2 EQU %01010101
LDAA #Data_1
ADDA #Data_2

A) $12
B) $67
C) $55
D) $57

Answers

It’s b.$67 I hope it helps I am not that good at technology I am good at other thing

To encrypt messages I propose the formula C = (3P + 1) mod 27, where P is the "plain text" (the original letter value) and C is the "cipher text" (the encrypted letter value). For example, if P = 2 (the letter 'c' ), C would be 7 (the letter 'h') since (3(2) + 1) mod 27 = 7. There is a problem though: When I send the message 'c' to my friend, encrypted as 'h', they don't know whether the original message was 'c' or another letter that also encrypts to 'h'. What other letter(s) would also encrypt to 'h' besides 'c' in this system?

Answers

Answer:

C = (3P+1) % 27

so when P will be max 26,when P is 26 the (3P+1) = 79. And 79/27 = 2 so let's give name n = 2.

Now doing reverse process

We get ,

P = ((27*n)+C-1)/3

Where n can be 0,1,2

So substituting value of n one by one and the C=7(corresponding index of h)

For n= 0,we get P=2, corresponding char is 'c'

For n=1,we get P=11, corresponding char is 'l'

For n=2,we get P= 20, corresponding cahr is 'u'.

So beside 'c',the system will generate 'h' for 'l' and 'u' also.

6 things you should consider when planning a PowerPoint Presentation.

Answers

Answer: I would suggest you consider your audience and how you can connect to them. Is your presentation, well, presentable? Is whatever you're presenting reliable and true? Also, no more than 6 lines on each slide. Use colors that contrast and compliment. Images, use images. That pulls whoever you are presenting to more into your presentation.

Explanation:


The equation of certain traveling waves is y(x.t) = 0.0450 sin(25.12x - 37.68t-0.523) where x and y are in
meters, and t in seconds. Determine the following:
(a) Amplitude. (b) wave number (C) wavelength. (d) angular frequency. (e) frequency: (1) phase angle, (g) the
wave propagation speed, (b) the expression for the medium's particles velocity as the waves pass by them, and (i)
the velocity of a particle that is at x=3.50m from the origin at t=21.os​

Answers

Answer:

A. 0.0450

B. 4

C. 0.25

D. 37.68

E. 6Hz

F. -0.523

G. 1.5m/s

H. vy = ∂y/∂t = 0.045(-37.68) cos (25.12x - 37.68t - 0.523)

I. -1.67m/s.

Explanation:

Given the equation:

y(x,t) = 0.0450 sin(25.12x - 37.68t-0.523)

Standard wave equation:

y(x, t)=Asin(kx−ωt+ϕ)

a.) Amplitude = 0.0450

b.) Wave number = 1/ λ

λ=2π/k

From the equation k = 25.12

Wavelength(λ ) = 2π/25.12 = 0.25

Wave number (1/0.25) = 4

c.) Wavelength(λ ) = 2π/25.12 = 0.25

d.) Angular frequency(ω)

ωt = 37.68t

ω = 37.68

E.) Frequency (f)

ω = 2πf

f = ω/2π

f = 37.68/6.28

f = 6Hz

f.) Phase angle(ϕ) = -0.523

g.) Wave propagation speed :

ω/k=37.68/25.12=1.5m/s

h.) vy = ∂y/∂t = 0.045(-37.68) cos (25.12x - 37.68t - 0.523)

(i) vy(3.5m, 21s) = 0.045(-37.68) cos (25.12*3.5-37.68*21-0.523) = -1.67m/s.

Other Questions
In the modern political system, which of the following statements accurately portrays a major disagreement between Democrats and Republicans? A. Democrats favor greater use of military force abroadB. Republicans favor greater regulation of the economyC. Republicans are more likely to favor social policy that contradicts traditional valuesD. Democrats are more likely to support expensive social programs to assist the poor Which term BEST describes the movement of air from the ocean toward the land in the daytime? (AKS 4b DOK 1) *1 pointSea breezeLand BreezeValley BreezeCurrent Breeze What does the balloon symbolize to Mattie at the close of the book or story? 1.(1 0) You measure the distance, l, a projectile travels several times using the same apparatus and find the following values (cm): 5.11, 4.89, 5.04, 4.94, 4.93, 5.06 and 5.09. Assuming that the errors are random: a) What is the mean value forl? b) What is the standard deviation for this data set? c) What is the uncertainty associated with your best estimate forl? d) How should one report the result of this measurement along with the uncertainty at the 95 % confidence level? e) If you desire to reduce the statistical uncertainty associated with the reported result using the same apparatus to be only 0.01 cm, how many measurements must be made? (Eugenio / estudiar para ser /)(en nuestra comunidad / haber muchos /(yo / trabajar como / _go / talojar como / (nosotros / conocer a // muy capaz)(el autor / querer trabajar con // bueno )(t / hacerse /__) set f(y)=x and solve for y Tate is paid $17.35 per hour with time and a half overtime. What will his gross pay period in which he worked 35 hours one week and 44 hours next week for a total 79 hours? Please help me with my work for math The transformation from the function f(x) = 3X to the function f(x)= 3x+4 indicate Which of the following is NOT true about groundwater pollution?A) It is most dangerous because water flows for many miles.B) Groundwater is often contaminated when people dump toxins into wells.C)The main source of groundwater is rain and snow.D) A toxic substance from a closed factory can affect the groundwater for years.PLEASE HELP :) Will give brainliest Need help ASAP. WILL MARK BRAINLIEST. s varies directly as t, and = 8 when = 16. Find the constant of variation and write a direct variation equation relating s and t. Then find t when = 16. (Write answers in decimal form.)constant of variation: direct variation equation: when s=16, t= Combine the Expression:(10x - 4) + (-7 + x) Laws concerning the administration of the United States within its own borders are generally known as which of the following? Select one: A. domestic policy B. tort reform C. foreign policy D. judicial reform De realizat un reportaj despre spectacolul ,,conu Leonida fata cu reactiunea'' de ion luca caragiale CEerinte: 1de prezentat succint actiunile din comedie si personajele implicate 2de comentat jocul actorilor decorul si muzica 3de remarcat despre utilitatea spectacolului(cui se adreseaza si ce efecte poate avea asupra spectatorilor Identify the subjunctive verb in each sentence below.She acts as if she were Queen.a. actsb. as ifC. were Maya is asked to find the GCF of each term in the expression 32 x y minus 18 y. Her work is shown below. Factors of 32xy: 1, 2, 4, 8, 16, 32, x, y Factors of 18y: 1, 2, 3, 6, 9, 18, y GCF: (1) (2) (x) (y) The GCF is 2 x y. Which best describes the accuracy of Mayas solution? Mayas solution is accurate. Maya factored 32xy incorrectly. Maya factored 18y incorrectly. Maya factored correctly, but did not find the correct GCF. A line has the equation 3x4y12=0.Is the point (2, 1) on the graph? Translate to EnglishBrandon prend rapidement les crales et il les emmne dans sachambre.Sa maman le voit et elle va dans la chambre de Brandon pour voir ce qu'il fait. Elle entre dans la chambre. Brandon la voit et il est trs nerveux parce queson chiot fait beaucoup de bruit. Brandon a une solution: il fait des bruitscomme un chiot.- Mmmm... ouaf-ouaf! >> dit Brandon.- Brandon, pourquoi est-ce que tu fais des bruits comme un chiot? demandesa maman.- Parce que je veux un chiot. Ha, ha, ha! Je suis un chien. Mmm...mmm, >>lui rpond Brandon Qu frases son ciertas sobre Paraguay?En el Chaco se habla alemn.El espaol es el nico idioma oficial de Paraguay.Los menonitas que viven en el Chaco vinieron de Canad y Rusia.Se tonel t mate en Paraguay porque es una costumbre guaran.Los guaran no queran la ayuda de los Jesuitas.