Write a program that uses the map template class to compute a histogram of positive numbers entered by the user. The map’s key should be the number that is entered, and the value should be a counter of the number of times the key has been entered so far. Use –1 as a sentinel value to signal the end of user input.512355321-1Then the program should output the followings:The number 3 occurs 2 timesThe number 5 occurs 3 timesThe number 12 occurs 1 timesThe

Answers

Answer 1

Answer:

See explaination

Explanation:

#include <iostream>

#include <map>

#include <string>

#include <algorithm>

#include <cstdlib>

#include <iomanip>

using namespace std;

int main()

{

map<int, int> histogram;

int a=0;

while(a>=0)

{

cout << " enter value of a" ;

cin >>a;

histogram[a]++;

}

map<int,int>::iterator it;

for ( it=histogram.begin() ; it != histogram.end(); it++ )

{

cout << (*it).first << " occurs " << setw(3) << (*it).second << (((*it).second == 1) ? " time." : " times.") <<endl;

}

return 0;

}


Related Questions

Write the definition of a function words_typed, that receives two parameters. The first is a person's typing speed in words per minute (an integer greater than or equal to zero). The second is a time interval in seconds (an integer greater than zero). The function returns the number of words (an integer) that a person with that typing speed would type in that time interval.

Answers

Answer:

   //Method definition of words_typed

   //The return type is int

   //Takes two int parameters: typingSpeed and timeInterval

   public static int words_typed(int typingSpeed, int timeInterval) {

       //Get the number of words typed by  

       //finding the product of the typing speed and the time interval

       //and then dividing the result by 60 (since the typing speed is in "words

       // per minute"  and the time interval is in "seconds")

       int numberOfWords = typingSpeed * timeInterval / 60;

       

       //return the number of words

       return numberOfWords;

       

   }        //end of method declaration

Explanation:

The code above has been written in Java and it contains comments explaining each of the lines of the code. Please go through the comments.

Answer:

I am writing the program in Python.

def words_typed(typing_speed,time_interval):

   typing_speed>=0

   time_interval>0

   no_of_words=int(typing_speed*(time_interval/60))

   return no_of_words

   

output=words_typed(20,30)

print(output)

Explanation:

I will explain the code line by line.

First the statement def words_typed(typing_speed,time_interval) is the definition of a function named words_typed which has two parameters typing_speed and time_interval.

typing_speed variable of integer type in words per minute.

time_interval variable of int type in seconds

The statements typing_speed>=0 and time_interval>0 means that value of typing_speed is greater than or equal to zero and value of time_interval is greater than zero as specified in the question.

The function words_typed is used to return the number of words that a  person with typing speed would type in that time interval. In order to compute the words_typed, the following formula is used:

   no_of_words=int(typing_speed*(time_interval/60))

The value of typing_speed is multiplied by value of time_interval in order to computer number of words and the result of the multiplication is stored in no_of_words. Here the time_interval is divided by 60 because the value of time_interval is in seconds while the value of typing_speed is in minutes. So to convert seconds into minutes the value of time_interval is divided by 60 because 1 minute = 60 seconds.

return no_of_words statement returns the number of words.

output=words_typed(20,30) statement calls the words_typed function and passed two values i.e 20 for typing_speed and 30 for time_interval.

print(output) statement displays the number of words a person with typing speed would type in that time interval, on the output screen.

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 !!!

3. You are working for a usability company that has recently completed a usability study of an airline ticketing system. They conducted a live AB testing of the original website and a new prototype your team developed. They brought in twenty participants into the lab and randomly assigned them to one of two groups: one group assigned to the original website, and the other assigned to the prototype. You are provided with the data and asked to perform a hypothesis test. Using the standard significance value (alpha level) of 5%, compute the four step t-test and report all important measurements. You can use a calculator or SPSS or online calculator to compute the t-test. (4 pts)

Answers

Answer:

Check the explanation

Explanation:

Let the population mean time on task of original website be [tex]\mu_1[/tex] and that of new prototype be [tex]\mu_2[/tex]

Here we are to test

[tex]H_0:\mu_1=\mu_2\;\;against\;\;H_1:\mu_1<\mu_2[/tex]

The data are summarized as follows:

                                                       Sample 1             Sample 2

Sample size                                        n=20                    n=20

Sample mean                                 [tex]\bar{x}_1=243.4[/tex]             [tex]\bar{x}_2=253.4[/tex]

Sample SD                                     s1=130.8901          s2=124.8199

The test statistic is obtained from online calculator as

t=-0.23

The p-value is given by 0.821

As the p-value is more than 0.05, we fail to reject the null hypothesis at 5% level of significance and hence conclude that there is no statistically significant difference between the original website and the prototype developed by the team at 5% level of significance.

(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

Describe the series of connections that would be made, equipment and protocol changes, if you connected your laptop to a wireless hotspot and opened your email program and sent an email to someone. Think of all the layers and the round trip the information will likely make.

Answers

Answer:

Check Explanation.

Explanation:

Immediately there is a connection between your laptop and the wireless hotspot, data will be transferred via the Physical layer that will be used for encoding of the network and the modulation of the network and that layer is called the OSI MODEL.

Another Important layer is the APPLICATION LAYER in which its main aim and objectives is for support that is to say it is used in software supporting.

The next layer is the PRESENTATION LAYER which is used during the process of sending the e-mail. This layer is a very important layer because it helps to back up your data and it is also been used to make connections of sessions between servers of different computers

Select the correct navigational path to create the function syntax to use the IF function.
Click the Formula tab on the ribbon and look in the ???
'gallery
Select the range of cells.
Then, begin the formula with the ????? click ?????. and click OK.
Add the arguments into the boxes for Logical Test, Value_if_True, and Value_if_False.​

Answers

Answer:

1. Logical

2.=

3.IF

Explanation:

just did the assignment

4. What are the ethical issues of using password cracker and recovery tools? Are there any limitations, policies, or regulations in their use on local machines, home networks, or small business networks? Where might customer data be stored? Discuss any legal issues in using these tools on home networks in the United States, which has anti-wiretap communications regulations. Who must know about the tools being used in your household?

Answers

Answer:

There are no limitation, policies or regulations that limit these tools for use on privately owned machines or home networks. In most businesses networks, intranets or internets the use of them is illegal if used for malicious intent. Penetration testing teams sign rules of engagement before using these tools.

Explanation:

There are no limitation, limitations, policies, or regulations in their use on local machines, privately owned machines or home networks, or small business networks.

In most businesses networks, intranets or internets the use of them is often and mostly illegal especially in a situation where they are been used for malicious intent.

Penetration testing teams would often or always make sure that they sign rules of engagement before using these tools.

Kitchen Gadgets sells a line of high-quality kitchen utensils and gadgets. When customers place orders on the company’s Web site or through electronic data interchange (EDI), the system checks to see if the items are in stock, issues a status message to the customer, and generates a shipping order to the warehouse, which fills the order. When the order is shipped, the customer is billed. The system also produces various reports.

1. List four elements used in DFDs, draw the symbols, and explain how they are used.

2. Draw a context diagram for the order system.

3. Draw a diagram 0 DFD for the order system.

4. Explain the importance of leveling and balancing. Your boss, the IT director, wants you to explain FDDs, BPM, DFDs, and UML to a group of company managers and users who will serve on a systems development team for the new marketing system.

Answers

Answer:

Ahhhhh suckkkkkkkkkkk

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 !!!

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.

An organization’s SOC analyst, through examination of the company’s SIEM, discovers what she believes is Chinese-state sponsored espionage activity on the company’s network. Management agrees with her initial findings given the forensic artifacts she presents are characteristics of malware, but management is unclear on why the analyst thought it was Chinese-state sponsored. You have been brought in as a consultant to help determine 1) whether the systems have been compromised and 2) whether the analyst’s assertion has valid grounds to believe it is Chinese state-sponsored. What steps would you take to answer these questions given that you have been provided a MD5 hashes, two call back domains, and an email that is believed to have been used to conduct a spearphishing attack associated with the corresponding MD5 hash. What other threat intelligence can be generated from this information and how would that help shape your assessment?

Answers

Answer: Provided in the explanation segment

Explanation:

Below is a detailed explanation to make this problem more clearer to understand.

(1). We are asked to determine whether the systems have been compromised;

Ans: (YES) From the question given, We can see that the System is compromised. This is so because the plan of communication has different details of scenarios where incidents occur. This communication plan has a well read table of contents that lists specific type of incidents, where each incident has a brief description of the event.

(2). Whether the analyst’s assertion has valid grounds to believe it is Chinese state-sponsored.

Ans: I can say that the analyst uses several different internet protocol address located in so as to conduct its operations, in one instance, a log file recovered  form an open indexed server revealed tham an IP address located is used to administer the command control node that was communicating with the malware.

(3). What other threat intelligence can be generated from this information?

Ans: The threat that can be generated from this include; Custom backdoors, Strategic web compromises, and also Web Server  exploitation.

(4). How would that help shape your assessment?

Ans: This helps in such a way where information is gathered and transferred out of the target network which involve movement of files through multiple systems.

Files also gotten from networks as well as  using tools (archival) to compress and also encrypt data with effectiveness of their data theft.

cheers i hope this helped!!!

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.

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:

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

Answers

Answer:

Bits

Explanation:

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?

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.

what should i name my slideshow if its about intellectual property, fair use, and copyright

Answers

Answer:

You should name it honest and sincere intention

Explanation:

That is a good name for what you are going to talk about in your slideshow.

A company that wants to send data over the Internet has asked you to write a program that will encrypt it so that it may be transmitted more securely. All the data is transmitted as four-digit integers. Your app should read a four-digit integer entered by the user and encrypt it as follows: Replace each digit with the result of adding 7 to the digit and getting the remainder after dividing the new value by 10. Then swap the first digit with the third, and swap the second digit with the fourth. Then display the encrypted integer. Write a separate app that inputs an encrypted four-digit integer and decrypts it (by reversing the encryption scheme) to form the original number. Use the format specifier D4 to display the encrypted value in case the number starts with a 0

Answers

Answer:

The output of the code:

Enter a 4 digit integer : 1 2 3 4

The decrypted number is : 0 1 8 9

The original number is : 1 2 3 4

Explanation:

Okay, the code will be written in Java(programming language) and the file must be saved as "Encryption.java."

Here is the code, you can just copy and paste the code;

import java.util.Scanner;

public class Encryption {

public static String encrypt(String number) {

int arr[] = new int[4];

for(int i=0;i<4;i++) {

char ch = number.charAt(i);

arr[i] = Character.getNumericValue(ch);

}

for(int i=0;i<4;i++) {

int temp = arr[i] ;

temp += 7 ;

temp = temp % 10 ;

arr[i] = temp ;

}

int temp = arr[0];

arr[0] = arr[2];

arr[2]= temp ;

temp = arr[1];

arr[1] =arr[3];

arr[3] = temp ;

int newNumber = 0 ;

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

newNumber = newNumber * 10 + arr[i];

String output = Integer.toString(newNumber);

if(arr[0]==0)

output = "0"+output;

return output;

}

public static String decrypt(String number) {

int arr[] = new int[4];

for(int i=0;i<4;i++) {

char ch = number.charAt(i);

arr[i] = Character.getNumericValue(ch);

}

int temp = arr[0];

arr[0]=arr[2];

arr[2]=temp;

temp = arr[1];

arr[1]=arr[3];

arr[3]=temp;

for(int i=0;i<4;i++) {

int digit = arr[i];

switch(digit) {

case 0:

arr[i] = 3;

break;

case 1:

arr[i] = 4;

break;

case 2:

arr[i] = 5;

break;

case 3:

arr[i] = 6;

break;

case 4:

arr[i] = 7;

break;

case 5:

arr[i] = 8;

break;

case 6:

arr[i] = 9;

break;

case 7:

arr[i] = 0;

break;

case 8:

arr[i] = 1;

break;

case 9:

arr[i] = 2;

break;

}

}

int newNumber = 0 ;

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

newNumber = newNumber * 10 + arr[i];

String output = Integer.toString(newNumber);

if(arr[0]==0)

output = "0"+output;

return output;

}

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter a 4 digit integer:");

String number = sc.nextLine();

String encryptedNumber = encrypt(number);

System.out.println("The decrypted number is:"+encryptedNumber);

System.out.println("The original number is:"+decrypt(encryptedNumber));

}

}

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();

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

Fill in the empty function so that it returns the sum of all the divisors of a number, without including it. A divisor is a number that divides into another without a remainder. in python

Answers

for divisor in divisors (number):
answer += 1

return answer

Program explanation:

In the given program code, a method "sum_divisors" is declared that takes "n" variable in its parameter.Inside the method, the "s" variable is declared, which holds a value which is "0", and used a for loop that defines counts the range values.In the loop, a conditional statement is declared that check remainder value equal to 0 and adds value in "s" variable and return its value.  

Program code:

def sum_divisors(n):#defining a method sum_divisors that takes a parameter

   s = 0#defining a variable s that hold a value 0

   for x in range(1,n):#defining a for loop that use n variable to check range value

       if(n%x==0):#use if to check remainder value equal to 0  

           s += x#adding value in s variable

   return s#return s value

print(sum_divisors(6))#calling method

print(sum_divisors(12))#calling method

Output:

Please find the attached file.

Learn more:

brainly.com/question/14704583

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.

(34+65+53+25+74+26+41+74+86+24+875+4+23+5432+453+6+42+43+21)°

Answers

11,37 is the answer hope that helps

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.

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.

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.

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

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

Write a class called DisArray with methods to convert a 1-dimensional array to a 2-dimensional array. The methods' name should be convert2D. You should create methods to convert int[] and String[], that can be tested against the following class. Your convert2D methods should choose the closest possible square-ish size for the 2D array. For example, if your input array is [10], its 2D conversion should be [3][4] or [4][3] -- you decide if you want to favor rows over columns. Your method should place the elements of the one-dimensional array into the two-dimensional array in row-major order, and fill the remaining elements with 0 (for integer arrays) or null (for String arrays). The process of filling unused elements with 0 or null is called padding. If the input array's length is a perfect square, e.g., [16], then your output should a square array, i.e., [4][4]. For any other size, your objective is to minimize the number of padded elements. For example, if your input is [10] you should opt for a [3][4] array instead of a [4][4]. The former will have only 2 padded elements; the latter 6.

Answers

Answer:

=======================================================

//Class header definition

public class DisArray {

   //First method with int array as parameter

   public static void convert2D(int[] oneD) {

       //1. First calculate the number of columns

       //a. get the length of the one dimensional array

       int arraylength = oneD.length;

       //b. find the square root of the length and typecast it into a float

       float squareroot = (float) Math.sqrt(arraylength);

       //c. round off the result and save in a variable called row

       int row = Math.round(squareroot);

       //2. Secondly, calculate the number of columns

       //a. if the square of the number of rows is greater than or equal to the

       //length of  the one dimensional array,

       //then to minimize padding, the number of

       //columns  is the same as the number of rows.

       //b. otherwise, the number of columns in one more than the

       // number of rows

       int col = ((row * row) >= arraylength) ? row : row + 1;

       //3. Create a 2D int array with the number of rows and cols

       int [ ][ ] twoD = new int [row][col];

       //4. Place the elements in the one dimensional array into

       //the two dimensional array.

       //a. First create a variable counter to control the cycle through the one

       // dimensional array.

       int counter = 0;

       //b. Create two for loops to loop through the rows and columns of the

       // two  dimensional array.

       for (int i = 0; i < row; i++) {

           for (int j = 0; j < col; j++) {

               //if counter is less then the length of the one dimensional array,

               //then  copy the element at that position into the two dimensional

               //array.  And also increment counter by one.

               if (counter < oneD.length) {

                   twoD[i][j] = oneD[counter];

                   counter++;

              }

              //Otherwise, just pad the array with zeros

               else {

                   twoD[i][j] = 0;

               }

           }

       }

       //You might want to create another pair of loop to print the elements

       //in the  populated two dimensional array as follows

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

           for (int j = 0; j < twoD[i].length; j++) {

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

           }

           System.out.println("");

       }

   }     //End of first method

   //Second method with String array as parameter

   public static void convert2D(String[] oneD) {

       //1. First calculate the number of columns

       //a. get the length of the one dimensional array

       int arraylength = oneD.length;

       //b. find the square root of the length and typecast it into a float

       float squareroot = (float) Math.sqrt(arraylength);

       //c. round off the result and save in a variable called row

       int row = Math.round(squareroot);

       //2. Secondly, calculate the number of columns

       //a. if the square of the number of rows is greater than or equal to the length of  

       //the one dimensional array, then to minimize padding, the number of

       //columns  is the same as the number of rows.

       //b. otherwise, the number of columns in one more than the

       //number of rows.

       int col = (row * row >= arraylength) ? row : row + 1;

       //3. Create a 2D String array with the number of rows and cols

       String[][] twoD = new String[row][col];

       //4. Place the elements in the one dimensional array into the two

       // dimensional array.

       //a. First create a variable counter to control the cycle through the one

       // dimensional array.

       int counter = 0;

       //b. Create two for loops to loop through the rows and columns of the

       //two  dimensional array.

       for (int i = 0; i < row; i++) {

           for (int j = 0; j < col; j++) {

               //if counter is less then the length of the one dimensional array,

               //then  copy the element at that position into the two dimensional

               //array.  And also increment counter by one.

               if (counter < oneD.length) {

                   twoD[i][j] = oneD[counter];

                   counter++;

               }

               //Otherwise, just pad the array with null values

               else {

                   twoD[i][j] = null;

               }

           }

       }

       //You might want to create another pair of loop to print the elements  

       //in the populated two dimensional array as follows:

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

           for (int j = 0; j < twoD[i].length; j++) {

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

           }

           System.out.println("");

       }

   }    // End of the second method

   //Create the main method

   public static void main(String[] args) {

       //1. Create an arbitrary one dimensional int array

       int[] x = {23, 3, 4, 3, 2, 4, 3, 3, 5, 6, 5, 3, 5, 5, 6, 3};

       //2. Create an arbitrary two dimensional String array

       String[] names = {"abc", "john", "dow", "doe", "xyz"};

       

       //Call the respective methods

       convert2D(x);

       System.out.println("");

       convert2D(names);

   }         // End of the main method

}            // End of class definition

=========================================================

==========================================================

Sample Output

23 3 4 3  

2 4 3 3  

5 6 5 3  

5 5 6 3  

abc john dow  

doe xyz null

==========================================================

Explanation:

The above code has been written in Java and it contains comments explaining each line of the code. Please go through the comments. The actual executable lines of code are written in bold-face to distinguish them from the comments.

Other Questions
YOU WILL GET BRAINLIEST!! What could help a country move from Stage 1 to Stage 2 of the demographictransition?- Instituting population restrictions-increased immigration-The diffusion of contraceptives-better sanitation-Improving education for women Arrasmith Corporation uses customers served as its measure of activity. During February, the company budgeted for 37,000 customers, but actually served 27,000 customers. The company uses the following revenue and cost formulas in its budgeting, where q is the number of customers served: Revenue: $5.50q Wages and salaries: $35,200 + $1.70q Supplies: $1.10q Insurance: $12,400 Miscellaneous expenses: $8,400 + $0.50q The company reported the following actual results for February: Revenue $ 159,800 Wages and salaries $ 70,000 Supplies $ 16,400 Insurance $ 12,400 Miscellaneous expense $ 27,700 Required: Prepare the company's flexible budget performance report for February. Label each variance as favorable (F) or unfavorable (U). (Indicate the effect of each variance by selecting "F" for favorable, "U" for unfavorable, and "None" for no effect (i.e., zero variance). Input all amounts as positive values.) the table shows jills math quiz scores. what is the minimum score she needs on her next quiz to have a mean of at least 92week 1: 92week 2: 96week 3: 94week 4: 88 Mills Corporation's balance sheet included the following information: Accounts Receivable $ 580,000 Less: Allowance for Doubtful Accounts 73,000 Accounts Receivable, Net of Allowance $ 507,000 If the Allowance account had a credit balance of $31,500 immediately before the year-end adjustment for bad debts and no accounts were written-off or allowed for during the year, what was the amount of Bad Debt Expense recognized during the year Fifteen mothers were asked how many months old their babies were when they cut their first tooth. The results are shown below.8, 8, 6, 8, 9, 10, 5, 7, 9, 5, 9, 7, 6, 8, 7Find the range and the outlier(s), if any, of the data set. Select all the following that describe isotopes of an element_ Different numbers of neutrons_ Different mass numbers_ Different atomic numbers_ Different numbers of protons Need help with Spanish! Math question down below PLEASE help! BRAINLIEST to correct answer! Suppose Clifford recently discovered oil in his fields, which greatly excites him because he can earn a profit of $ 31.00 per barrel based on present market conditions. Because production costs will be lower in five years, Clifford estimates that he can pump the oil out at a profit of $ 49.00 per barrel if he chooses to wait. If the interest rate currently is 1.00 %, what is the present value of the oil if he waits five years? Simplify.8(12 - p)20 - (8+p)96 - 8p96 - p96p Shades R Us charges $20 per day to rent a lounge chair and $15 per day to rent an umbrella. Dan and Lisa paid a total of $245 to rent a lounge chair and umbrella each during their vacation. Lisa rented the chair and umbrella for 1 day less than Dan. The following equation represents this situation, 20x+15x+20(x-1) = 245. What is the total amount Dan paid to rent the lounge chair and umbrella during his vacation DO, 2 of X = (2, -2) (4, 0) (8, 0) Vital Industries manufactured 1,200 units of its product Huge in the month of April. It incurred a total cost of $120,000 during the month. Out of this $120,000, $45,000 was the cost of direct materials used in the product and the rest was incurred because of the conversion cost involved in the process. Ryan had no opening or closing inventory. What will be the total cost per unit of the product, assuming conversion costs contained $10,000 of indirect labor help help!!!!!!!!!!!!!!!!!!!!!!! 2. You deposit $1200 into a bank account. Every year that accounts increase by 15 %.a) Identify whether this an Exponential Growth or Decay function and write the equation of thefunction Relate dark matter to the development of the universe after the Big Bang. In 3-5 sentences, speculate on how the development of the universe would have been different if there had been no dark matter. In your answer, use the term structures.Please answer this and ill mark you as brainliest Compare how the Dutch and the United States gained control of lands in Southeast Asia. Help please What is the value of x in the equation. 2/3(1/2x+12)=1/2(1/3x+14)-3?A:-24B:-6C:-2/3D:0 Look at the data points on the graph:Is this relation a function?