Questions
For this assignment, create a complete UML class diagram of this program. You can use Lucidchart...

For this assignment, create a complete UML class diagram of this program. You can use Lucidchart or another diagramming tool. If you can’t find a diagramming tool, you can hand draw the diagram but make sure it is legible.

Points to remember:

• Include all classes on your diagram. There are nine of them.

• Include all the properties and methods on your diagram.

• Include the access modifiers on the diagram. + for public, - for private, ~ for internal, # for protected

• Include the proper association lines connecting the classes that “know about” each other.

o Associations

o Dependencies

o Inheritance

o Aggregation

o Composition

• Static classes are designated on the diagram with > above the class name, and abstract classes are designated with > above the class name.

-------------------------------------------------------------------

static class GlobalValues
{
private static int maxStudentId = 100;

public static int NextStudentId
{
get
{
maxStudentId += 1;
return maxStudentId;
}
}
}

class College
{
public string Name { get; set; }
public Dictionary<string, Department> Departments { get; } = new Dictionary<string, Department> { };
internal College()
{
Departments.Add("ART", new ArtDept() { Name = "Art Dept" });
Departments.Add("MATH", new MathScienceDept() { Name = "Math /Science Dept" });
}
}

abstract class Department
{
public string Name { get; set; }
public Dictionary<string, Course> CourseList { get; } = new Dictionary<string, Course> { };
protected abstract void FillCourseList();
// Department constructor
public Department()
{
// When a department is instantiated fill its course list.
FillCourseList();
}
}
class ArtDept : Department
{
protected override void FillCourseList()
{
CourseList.Add("ARTS101", new Course(this, "ARTS101") { Name = "Introduction to Art" });
CourseList.Add("ARTS214", new Course(this, "ARTS214") { Name = "Painting 2" });
CourseList.Add("ARTS344", new Course(this, "ARTS344") { Name = "American Art History" });
}
}
class MathScienceDept : Department
{
protected override void FillCourseList()
{
CourseList.Add("MATH111", new Course(this, "MATH111") { Name = "College Algebra" });
CourseList.Add("MATH260", new Course(this, "MATH260") { Name = "Differential Equations" });
CourseList.Add("MATH495", new Course(this, "MATH495") { Name = "Senior Thesis" });
}
}

class Course
{
public readonly Department Department;
public readonly string Number;
private List<Enrollment> Enrollments { get; } = new List<Enrollment> { };
public string Name { get; set; }
internal Course(Department department, string number)
{
Department = department;
Number = number;
}
public void Enroll(Student student)
{
Enrollments.Add(new Enrollment(this, student));
Console.WriteLine($"{ student.Name } has been enrolled in \"{ Name }\".");
}
}

class Student
{
public readonly int Id;
private string name;
public string Name
{
get { return name; }
set
{
name = value;
Console.WriteLine($"{ name } is student ID: { Id }.");
}
}
// New Student constructor with a Student.Id
internal Student(int id)
{
Id = id;
}
// New Student constructor without a Student.Id
internal Student()
{
Id = GlobalValues.NextStudentId;
Console.WriteLine($"A new student has been assigned ID: \"{ Id }\".");
}
}

class Enrollment
{
public readonly Student Student;
public readonly Course Course;
internal Enrollment(Course course, Student student)
{
Student = student;
Course = course;
}
}
class Program
{
static void Main()
{
College MyCollege = new College();
Student Justin = new Student() { Name = "Justin" };
Student Gloria = new Student() { Name = "Gloria" };
MyCollege.Departments["ART"].CourseList["ARTS344"].Enroll(Justin);
MyCollege.Departments["ART"].CourseList["ARTS214"].Enroll(Gloria);
MyCollege.Departments["MATH"].CourseList["MATH111"].Enroll(Justin);
MyCollege.Departments["MATH"].CourseList["MATH260"].Enroll(Gloria);
Console.WriteLine("Press Enter to quit...");
Console.ReadLine();
}
}

In: Computer Science

Dominion Consulting in Sydney needs a shell script (to run on the Bourne shell) to maintain...

Dominion Consulting in Sydney needs a shell script (to run on the Bourne shell) to maintain its employee records file, which contains the following information (fields) about each employee:

  • telephone number (8 digits, first digit non-zero);

  • family name (alphabetic characters);

  • first name (alphabetic characters);

  • department number (2 digits) and

  • job title (alphabetic characters).
    This script should let users add, delete, search for, and display specific employee information.

Task Requirements

  1. Create a text file named records containing the following records with fields delimited by colons (:) :

    95671660:Jones:Sarah:45:sales manager 93272658:Smith:John:43:technical manager 98781987:Williams:Nick:35:computer officer 99893878:Brown:Sarah:12:electrician 95673456:Couch:David:26:chef 95437869:Anderson:Sarah:19:CEO

  2. In the beginning of your script you need to check to see whether the required text file (records) actually exists under the current directory. If records does not exist, your script must display an error message and then exit.

  3. The script must be named menu.sh. The script must show a menu of operations (see requirement 4) that a user may choose from. Among other tasks, these operations automate the following four activities:

    1. 1) Display all current employee records to the screen;

    2. 2) Search for and display specific employee record(s) (search all fields, ignoring case);

    3. 3) Add new records to the records file; and

    4. 4) Delete records from the records file.

  4. The script must show the following menu and prompt the user to select an option:

    Dominion Consulting Employees Info Main Menu ============================================ 1 – Print All Current Records
    2 - Search for Specific Record(s)

    3 - Add New Records 4 – Delete Records Q - Quit

  5. After a user chooses an option and the selected operation has been completed, the user is prompted to press the Enter key, and then the menu must be displayed again so that the user can make another selection.

  6. When adding a new employee record (option 3), the script must ask the user to provide the following field values (in order):

    phone number family name given name department number job title

  7. Each field must be correctly validated before the next field is requested. If validation fails, the user must be asked to enter the field again (and this process repeats until the field is successfully validated). After each successful employee record is added, the user should be prompted to ask if they want to enter another employee record (this process will continue until the user indicates they do not want to add another employee record).

    Validation is as follows: family name: must be alphabetic characters and/or spaces. given name:must be alphabetic characters and/or spaces. job title: must be alphabetic characters and/or spaces. phone number: the first digit of an eight-digit phone number must not be zero. Each telephone number must be unique (not already exist) department number: A valid department number must only contain 2 digits.

  8. When deleting records (option 4), the user must be prompted to enter a valid phone number. If the phone number is invalid, then the user will continue to be prompted until they enter a valid phone number. If a record matches the phone number entered (hint: as phone numbers are unique, only one record should match), then the matching record must be displayed, and the user must be prompted to confirm they want to delete the matching record.

In: Computer Science

2020 COS-241: DATA STRUCTURES Problem 2: Simulation: The Tortoise and the Hare DESCRIPTION This project deals...

2020 COS-241: DATA STRUCTURES

Problem 2: Simulation: The Tortoise and the Hare

DESCRIPTION

This project deals with the classic race between the tortoise and the hare. For this project, you be using random-number generation to move the creatures. To make things more interesting, the animals have to race up the side of a slippery mountain, which could cause them to lose ground. In this race either animal could win or there could be a tie with no clear winner.

The animals begin at "Square 1" of 70 squares. Each of the squares represents a position the animal can hold along the racetrack. The finish line is at Square 70. When an animal wins, a winning message of your choice should be posted. For example:

  • Yay! The rabbit won! He hops the fastest!

  • Woo-hooo! Slow and steady wins the race! Congratulations, turtle!

  • Tie score—no winner! Want to race again?

To start the race, print a message similar to:

  • Bang! Off they go!

There is a clock that ticks once per second. With each tick of the clock, your program should adjust the position of the animals according to the following rules:

Animal

Move Type

Percentage of the Time

Actual Move

Tortoise

Fast Plod

50%

3 squares to the right

Tortoise

Slip

20%

6 squares to the left

Tortoise

Slow Plod

30%

1 squares to the right

Hare

Sleep

20%

No move at all

Hare

Big Hop

20%

9 squares to the right

Hare

Big Slip

10%

12 squares to the left

Hare

Small Hop

30%

1 square to the right

Hare

Small Slip

20%

2 squares to the left

Keep track of the positions of the animals by using variables. If an animal slips, the lowest it can go is back to position 1. The highest it can go is to position 70 when it wins the race.

You will work with the percentages in the table above by generating a random integer current in the range

1≤ current ≤10.

For the tortoise, a "fast plod" is when 1≤ current ≤ 5, a "slip" when 6 ≤ current ≤ 7, or a "slow plod" 8 ≤ current ≤ 10. A similar approach would be used to set up the moves for the hare.

For each tick of the clock (each repetition of the loop), print a 70-position line showing the letter T in the tortoise’s position and the letter H in the hare’s position. If the two animals land on the same square, which may happen, the animals will bump. If this happens, print BUMP! at the current position.

After you print each line, check to see if either animal has landed on Square 70. If this happens, print a winning-type message.

It may make the simulation more interesting if you have users press any key after each iteration of the loop, so that they can see the movement of the animals.

DELIVERABLES

  • Your C++ source code with any header files

  • Your executable code

  • A document detailing how you will test your program that also includes screenshots of a few sample runs of your program.

  • An overview document giving the name of each file submitted and its purpose, as well as any discussion you have on implementing this program. If there are any problems with your program or it does not run or run as it is supposed to, please indicate that as well in this document.

please be original and dont really need to worry about taking screen shots as I will test it in visual studio

In: Computer Science

A printing shop that produces advertising specialties produces paper cubes of various sizes, of which the...

A printing shop that produces advertising specialties produces paper cubes of various sizes, of which the 3.5 inch cube is the most popular. The cubes are cut from a stack of paper on cutting presses. The two sides of the cube are determined by the distance of stops on the press from the cutting knife and remain fairly constant, but the height of the cube varies depending on the number of sheets included in a “lift” by the operator. The lift height does not remain constant within an operator or between operators. The difficulty is in judging, without taking much time, what thickness of lift will give the correct height when it is pressed by the knife and cut. The humidity in the atmosphere also contributes to this difficulty, because the paper swells when humidity is high. The operators tend to err on the safe side, by lifting a thicker stack of paper than necessary.

The company management believes the cubes are being made much taller than the target, thus giving away excess paper and causing loss to the company. They have received advice from a consultant that they could install a paper-counting machine, which will give the correct lift containing exactly the same number of sheets each time a lift is made. This, however, will entail a huge capital investment. To see if the capital investment would be justifiable, the company management wants to assess the current loss in paper because of the variability of the cube heights from the target.

Data were collected by measuring the heights of 20 groups of five cubes and are provided in the table below. Estimate the loss incurred because of the cubes being taller than 3.5 inches. A cube that is exactly 3.5 inches in height weighs 1.2 lb. The company produces 3 million cubes per year, and the cost of paper is $64 per hundred-weight (100lb.).

Note that the current population of cube heights has a distribution (assume this to be normal) with an average and standard deviation, and the target population of the cubes is also a distribution with an average of 3.5 in. and a standard deviation to be determined. (You can not make every cube exactly 3.5 in. in height.) The target standard deviation can be smaller than the current standard deviation, especially if the current process is subject to some assignable causes.

Estimate the current loss in paper because of the cubes being too tall. You first may have to determine the attainable variability before estimating the loss. If any of the information you need is missing, make suitable assumptions, and state them clearly.

3.61

3.59

3.53

3.63

3.63

3.57

3.61

3.52

3.47

3.53

3.61

3.65

3.30

3.52

3.60

3.59

3.59

3.58

3.58

3.57

3.60

3.64

3.44

3.59

3.61

3.49

3.65

3.52

3.50

3.53

3.61

3.58

3.58

3.64

3.57

3.59

3.54

3.52

3.60

3.58

3.44

3.54

3.60

3.51

3.63

3.62

3.63

3.52

3.63

3.53

3.55

3.64

3.60

3.59

3.63

3.59

3.54

3.57

3.59

3.63

3.60

3.62

3.60

3.62

3.57

3.54

3.58

3.49

3.60

3.55

3.53

3.62

3.51

3.49

3.63

3.63

3.65

3.60

3.61

3.63

3.66

3.64

3.63

3.62

3.61

3.68

3.65

3.63

3.64

3.63

3.63

3.64

3.61

3.61

3.63

3.64

3.61

3.63

3.61

3.62

In: Statistics and Probability

Master Budget Project Sam’s Computers manufactures laptop computer stands which can be personalized after mass-production. The...

Master Budget Project

Sam’s Computers manufactures laptop computer stands which can be personalized after mass-production. The company is completing its fifth year of operations and is preparing its master budget for the coming year (2018) based upon the following information:

Fourth-quarter sales for 2017 are 55,000 units. Third quarter sales for 2017 were 50,000 units.

Unit sales by quarter are projected as follows:

First quarter 2018        65,000

Second quarter 2018           70,000

Third quarter 2018              75,000

Fourth quarter       2018             90,000

First quarter 2019        80,000

Second quarter 2019           70,000

Each unit sells for $95. Sam’s Computers estimates that 50% of sales will be collected in the quarter of sale. The company also estimates that 30% will be collected in the quarter following the sale and that 20% of each quarter’s sale will be collected in the second quarter following the sale.

Sam’s tries to maintain at least 20% of next quarter sales forecast in inventory.

Each computer unit uses three hours of direct labor, three pieces of wood, and four cement moldings. Laborers are paid $10 per hour, one piece of wood costs $8, and cement moldings are $1.25 each.

At the end of each quarter, Sam’s plans to have 20 percent of the wood needs and 30 percent of the molding needs for the next quarter’s projected production needs.

Sam’s buys wood and cement moldings on account. Half of the purchases are paid for in the quarter of acquisition, and the remaining half are paid for in the following quarter. Wages and salaries are paid on the 30th of each month.

Fixed overhead totals $900,000 each quarter. Of this total, $200,000 represents depreciation. All other fixed expenses are paid for in cash in the quarter incurred.

Variable overhead is budgeted at $2 per direct labor hour. All variable overhead expenses are paid for in the quarter incurred.

Fixed selling and administrative expenses total $250,000 per quarter, including $50,000 depreciation.

Variable selling and administrative expenses are budgeted at $5 per unit sold. All selling and administrative expenses are paid for in the quarter incurred.

Sam will pay quarterly dividends of $300,000.

At the end of the third quarter, a $250,000 long-term debt payment will be made.

During the fourth quarter a $330,000 piece of equipment is purchased with cash.

At the end of the fourth quarter, taxes of $75,000 are due.

Sam’s beginning cash balance is $300,000. Sam must maintain a minimum balance of $250,000 at quarter end. He has access to a line of credit and borrows in multiples of $5,000. Interest of 5% is due quarterly.

Required:

Prepare a master budget for Sam’s Computers for each quarter of 2018 and for the year in total. The following component budgets must be included:

Sales budget

Production budget

Wood direct material budget

Cement moldings direct material budget

Direct labor budget

Overhead budget

Selling and administrative expenses budget

Cash receipts budget

Summary cash budget

You may work in groups of up to three or complete the project on your own. The master budget must be completed in Excel, and formulas must be used. Each group must turn in a hard copy of the master budget and a formula sheet on Tuesday, April 10. (Press CTRL + ` [grave accent] to switch between formulas and values in Excel).

Only one copy will need to be turned in for each group; however, each group member will need a copy for the in-class master budget quiz on April 10, which is part of the required course points.

In: Accounting

Case study In April 2019, Paul Marrapese, an independent security researcher from San Jose, California, has...

Case study

In April 2019, Paul Marrapese, an independent security researcher from San Jose, California, has published research warning that peer-to-peer software developed by Shenzhen Yunni Technology firm, that's used in millions of IoT devices around the world, has a vulnerability that could allow an attacker to eavesdrop on conversations or press household items into service as nodes in a botnet.
The software, called iLnkP2P, is designed to enable a user to connect to IoT devices from anywhere by using a smartphone app. The iLnkP2P functionality is built into a range of products from companies that include HiChip, TENVIS, SV3C, VStarcam, Wanscam, NEO Coolcam, Sricam, Eye Sight, and HVCAM.
What Marrapese found is that as many as 2 million devices, and possibly more, using iLnkP2P software for P2P communication do not have authentication or encryption controls built-in, meaning that an attacker could directly connect to a device and bypass the firewall. Marrapese discovered the iLinkP2P flaw after buying an inexpensive IoT-connected camera on Amazon.
"I found that I was able to connect to it externally without any sort of port forwarding, which both intrigued and concerned me," Marrapese told Information Security Media Group. "I found that the camera used P2P to achieve this, and started digging into how it worked. From there, I quickly learned how ubiquitous and dangerous it was."
While the flaws with the iLnkP2P peer-to-peer software apparently have not yet been exploited in the wild, Marrapses believes it's better for consumers to know now before an attacker decides to start taking advantage of this particular vulnerability.
"There have been plenty of stories in the past about IP cameras and baby monitors being hacked, but I believe iLnkP2P is a brand new vector not currently being exploited in the wild," Marrapese says. "With that being said, the biggest motivation behind this disclosure is to inform consumers before it's too late - because I believe it's only a matter of time."
As part of his research, Marrapese says he attempted to contact not only Shenzhen Yunni Technology but also several of the IoT manufacturers that use the company's P2P

software. As of Monday, even after publishing results, he had not heard back from anyone.
Users of IoT devices that make use of the iLnkP2P software scan a barcode or copy a six-digit number that is included in the product. From there, the owner can access the device from a smartphone app.
It's through these unique identifier numbers that Marrapese was able to discover that each device manufacturer used a specific alphabetic prefix to identify their particular product. For instance, HiChip uses "FFFF" as a prefix for the identification number for its devices. Once Marrapese was able to identify these devices through the unique number systems, he created several proof-of-concept attacks that took advantage of the flaws in the software.
[Source: https://www.databreachtoday.com/2-million-iot-devices-have-p2p-software-flaw-researcher-a-12428 Accessed July 2020]
a) In this case study, it is mentioned that vulnerable IoT devices can service as nodes in a botnet. Explain the working mechanism of a Botnet. Discuss any two attacks carried out by a botnet.
[8 Marks]
b) Report the importance of security in IoT devices. How does encryption help improve security for these devices?
[6 Marks]
c) Discuss the importance of lightweight cryptography in IoT enabled low-power devices. List the potential lightweight cryptographic algorithms for low-power IoT devices.

In: Computer Science

SOARING EAGLE SKATE COMPANY As a child, Stan Eagle just knew he loved riding his skateboard...

SOARING EAGLE SKATE COMPANY
As a child, Stan Eagle just knew he loved riding his skateboard and doing tricks. By the time he was a teenager, he was so proficient at the sport that he began entering professional contests and taking home prize money. By his twenties, Eagle was so successful and popular that he could make skateboarding his career. A skateboard maker sponsored him in competitions and demonstrations around the world.

The sponsorship and prize money paid enough to support him for several years. But then interest in the sport waned, and Eagle knew he would have to take his business in new directions. He believed skateboarding would return to popularity, so he decided to launch into designing, building, and selling skateboards under his own brand. To finance Soaring Eagle Skate Company, he pooled his own personal savings with money from a friend, Pete Williams, and came up with $75,000. Sure enough, new young skaters began snapping up the skateboards, attracted in part by the products' association with a star.

As the company prospered, Eagle considered ideas for expansion. Another friend had designed a line of clothing he thought would appeal to Eagle's skateboarding fans, and Eagle's name on the product would lend it credibility. At the friend's urging, Eagle branched out into clothing for skateboarders. However, he discovered that the business of shorts and shirts is far different from the business of sports equipment. The price markups were tiny, and the sales channels were entirely different. Three years into the expansion, Soaring Eagle had invested millions of dollars in the line but was still losing money. Eagle decided to sell off that part of the business to a clothing company and cut his losses.

Soon after that experiment, cofounder Williams proposed another idea: They should begin selling other types of sports equipment—inline roller skates and ice skates. Selling equipment for more kinds of sports would produce more growth than the company could obtain by focusing on just one sport. Eagle was doubtful. He was considered one of the most knowledgeable people in the world about skateboarding. He knew nothing about inline skating and ice skating. Eagle argued that the company would be better off focusing on the sport in which it offered the most expertise. Surely there were ways to seek growth within that sport—or at least to avoid the losses that came from investing in industries in which the company lacked experience.

Williams continued to press Eagle to try his idea. He pointed out that unless the company took some risks and expanded into new areas, there was little hope that Williams and Eagle could continue to earn much of a return on the money they had invested. Eagle was troubled. The attempt at clothing delivered, he thought, a message that they needed to be careful about expansion. But he seemed unable to persuade Williams to accept his point of view. He could go along with Williams and take the chance of losing money again, or he could use money he had earned from his business to buy Williams's ownership share in the company and then continue running Soaring Eagle on his own.

DISCUSSION QUESTIONS
1.

How do the characteristics of management decisions—uncertainty, risk, conflict, and lack of structure—affect the decision facing Stan Eagle?

2.

What steps can Eagle take to increase the likelihood of making the best decision in this situation?

In: Operations Management

In April 2019, Paul Marrapese, an independent security researcher from San Jose, California, has published research...

In April 2019, Paul Marrapese, an independent security researcher from San Jose,
California, has published research warning that peer-to-peer software developed by
Shenzhen Yunni Technology firm, that's used in millions of IoT devices around the world,
has a vulnerability that could allow an attacker to eavesdrop on conversations or press
household items into service as nodes in a botnet.
The software, called iLnkP2P, is designed to enable a user to connect to IoT devices from
anywhere by using a smartphone app. The iLnkP2P functionality is built into a range of
products from companies that include HiChip, TENVIS, SV3C, VStarcam, Wanscam, NEO
Coolcam, Sricam, Eye Sight, and HVCAM.
What Marrapese found is that as many as 2 million devices, and possibly more, using
iLnkP2P software for P2P communication do not have authentication or encryption
controls built-in, meaning that an attacker could directly connect to a device and bypass
the firewall. Marrapese discovered the iLinkP2P flaw after buying an inexpensive IoT-
connected camera on Amazon.
"I found that I was able to connect to it externally without any sort of port forwarding,
which both intrigued and concerned me," Marrapese told Information Security Media
Group. "I found that the camera used P2P to achieve this, and started digging into how
it worked. From there, I quickly learned how ubiquitous and dangerous it was."
While the flaws with the iLnkP2P peer-to-peer software apparently have not yet been
exploited in the wild, Marrapses believes it's better for consumers to know now before
an attacker decides to start taking advantage of this particular vulnerability.
"There have been plenty of stories in the past about IP cameras and baby monitors being
hacked, but I believe iLnkP2P is a brand new vector not currently being exploited in the
wild," Marrapese says. "With that being said, the biggest motivation behind this
disclosure is to inform consumers before it's too late - because I believe it's only a matter
of time."
As part of his research, Marrapese says he attempted to contact not only Shenzhen
Yunni Technology but also several of the IoT manufacturers that use the company's P2P

software. As of Monday, even after publishing results, he had not heard back from
anyone.
Users of IoT devices that make use of the iLnkP2P software scan a barcode or copy a six-
digit number that is included in the product. From there, the owner can access the
device from a smartphone app.
It's through these unique identifier numbers that Marrapese was able to discover that
each device manufacturer used a specific alphabetic prefix to identify their particular
product. For instance, HiChip uses "FFFF" as a prefix for the identification number for its
devices. Once Marrapese was able to identify these devices through the unique number
systems, he created several proof-of-concept attacks that took advantage of the flaws
in the software.
[Source: https://www.databreachtoday.com/2-million-iot-devices-have-p2p-software-
flaw-researcher-a-12428 Accessed July 2020]

a) In this case study, it is mentioned that vulnerable IoT devices can service as nodes
in a botnet. Explain the working mechanism of a Botnet. Discuss any two attacks
carried out by a botnet.

b) Report the importance of security in IoT devices. How does encryption help improve
security for these devices?

c) Discuss the importance of lightweight cryptography in IoT enabled low-power
devices. List the potential lightweight cryptographic algorithms for low-power IoT
devices.

In: Computer Science

modify the code below to create a GUI program that accepts a String from the user...

modify the code below to create a GUI program that accepts a String from the user in a TextField and reports whether or not there are repeated characters in it. Thus your program is a client of the class which you created in question 1 above.


N.B. most of the modification needs to occur in the constructor and the actionPerformed() methods. So you should spend time working out exactly what these two methods are doing, so that you can make the necessary modifications.

Q1 CODE: (do not modify this one)

public class QuestionOne {
// main funtion
public static void main(String []args) {
Scanner sc = new Scanner(System.in);
// get user input string
System.out.println("Enter a String: ");
String s = sc.nextLine();
// calling the static function and store it to a variable
boolean repeatChar = repeatCharacter(s);
// if the result of the static function is true
if(repeatChar){
// print has repeated characters
System.out.println("String has repeated characters");
}
else {
// if not display no repeated characters
System.out.println("String does not have repeated characters");
}
}
// static function that accepts string as parameter
public static boolean repeatCharacter(String s){
char ch;
//check if repeated character available or not
for(int i=0; i < s.length(); ++i) {
ch = s.charAt(i);
//check if the index and the last index of the character is same or not
if(s.indexOf(ch) != s.lastIndexOf(ch)) {   
return true;
}
}
// no character repetition return false
return false;
}

CODE TO MODIFY THE GUI: (Please modify this one)

//SimplApp.java - a simple example of a GUI program

//You should be able to give a brief description of what

//such a program will do and the steps involved

import javax.swing.*; //for JFrame, JButton, JLabel

import java.awt.*; //for Container, BorderLayout

import java.awt.event.*; //for WindowAdapter,

ActionListner, ActionEvent

public class SimplApp extends JFrame {

// define window's width and height in pixels

private static final int WIDTH = 400;

private static final int HEIGHT = 200;

// used for displaying text in the window

private JLabel infoLabel;

private class ButtonAction implements

ActionListener {

public void actionPerformed(ActionEvent e){

infoLabel.setText("You fool !!");

} //end of actionPerformed

} //end of class ButtonAction

// used to destroy/close the window

private class WindowDestroyer extends

WindowAdapter {

public void windowClosing(WindowEvent e){

dispose();

System.exit(0);

} //end of windowClosing()

} //end of class WindowDestroyer

// Below is the constructor for the class SimplApp

public SimplApp(String windowTitle) {

super(windowTitle);

setSize(WIDTH, HEIGHT);

// create content pane to add components to

window

Container c1 = getContentPane();

c1.setLayout( new BorderLayout());

// create a label component with the String

centred

infoLabel = new JLabel( "Initial",

JLabel.CENTER);

c1.add( infoLabel, BorderLayout.CENTER);

// create a button component

JButton button1=new JButton("Don't Press

Me!");

c1.add( button1, BorderLayout.NORTH);

//goes at top

// add an action event to button

ButtonAction myAction = new ButtonAction();

button1.addActionListener(myAction);

// add action event to window close button

WindowDestroyer myListener = new

WindowDestroyer();

addWindowListener( myListener);

} //end of SimplApp constructor

public static void main(String[] args) {

// calls constructor

SimplApp app = new SimplApp("Zzzz");

// display window on the screen

app.setVisible(true);

System.out.println("Finished

SimplApp.main()");

} //end of SimplApp.main()

} //end of SimplApp class

Thanks, anyone/expert answer person!


}

In: Computer Science

The advantages of e-mail communication. The first thing most of us do when we get up...

The advantages of e-mail communication.

The first thing most of us do when we get up in the morning is to turn on the computer and check for e-mail messages. This has become a part of our daily routine. We take it for granted that this has been an age-old practice and don't pause to think that it is a product of recent technological revolution. It is a wonder how we ever survived without it. The advantages of e-mail communication are many, and the chief among them are its speed, low cost, and convenience.

Speed is the obvious advantage. Just as our planes, trains, and automobiles are moving ever faster, so are our modes of communication. We can send e- mail around the world in a matter of minutes with no more effort than it takes to press a few keys on the computer. It is this speed that has led to our calling regular mail "snail mail."

E-Mail has also the advantage of being inexpensive. Many people have access to e-mail for free through their work or school. If some people may pay for e-mail through an online service, there is no increase in cost relative to the number of messages sent. It is the same price to send one message to one person as it is to send messages back and forth all day or to a hundred people. Finally, if we consider the costs saved in long-distance phone bills in addition to cost saved in postage, most e-mail users come out ahead.

There is no question that e-mail is convenient. It allows us to send the same message to many people at the same time with little more effort than it takes to send a message to one person. When sending multiple copies of a message, we avoid the trouble of photocopying the letter, printing out additional copies, addressing envelopes, and posting the mail. E-mail is also convenient because it lends itself to an informal style that makes composing a message relatively easy; in addition, readers of e-mail tolerate more mistakes than readers of conventional mail, and their tolerance saves us time.

E-Mail thus gives us the ability to send messages with convenience, speed and little expense. In not too distant a future, "snail mail" is likely to become obsolete, and one can already hear the bell toll for the US Postal Services.

Please answer the following Questions from above essay.

1. What is the topic of the essay?

2. What is the position taken by the writer on the topic?

3. Does the essay have a plan of development? If so, describe the plan.

4. Imagine you are the author of the essay. Take a reader curious to know how the essay developed through the pre-writing stage of the essay.

5. What are the three parts of the essay?

6. How does the essay hook the reader?

7. What is the first supporting point? What details does the writer give in support of the point?

8. What is the second supporting point? What details does the writer give in support of the point?

9. What is the third supporting point? What details does the writer give in support of the point?

10. What method of organization does the writer use to organize the material in the essay?

11. How does the essay conclude?

12. Why doesn't the writer discuss the disadvantages of e-mail communication in the essay?

In: Psychology