Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfaromanets
Creat Shape classes from scratch DETAILS You will create 3 shape classes (Circle, Rectangle,
Triangle) that all inherit from a single abstract class called AbstractShape which implements
Shape (also created by you). You are also responsible for creating the driver class
\"Assignment7.java\" (program that tests your classes and described on page 3) which does the
following reads input data from a file instantiates various objects of the three shapes based on the
input data stores each in a LinkedList outputs this list to an output file sorts a \"copy\" of this
LinkedList of objects outputs the sorted version of the list to the output file outputs the original
list to the output file This driver program also needs to \"ignore errors in the input file that breach
the specified input format as described in the Assianment7,java details (see page 3 1. Shape.java
This is an interface that has 2 abstract methods, and passes the responsibility of implementing the
compareTo method to the class that implements Shape (you may note, nomally Comparable is
\"implemented\" by a class. However, an interface cannot implement because interfaces can only
contain abstract methods. That said, an interface can only extend other interfaces and the
responsibility of actually \"implementing\" the abstract method(s) of the super class interface is
passed on to the sub-classes) public interface Shape extends Comparable public double
calculateAreal) Il This abstract method is implemented at the concrete level public Shape
copyShape); Il also implemented at the concrete level 2. AbstractShape.java public abstract class
AbstractShape implements Shape This class should contain an instance field to store the name of
each obiect. The constructor which sets this field should receive the name and a number to be
concatenated to the name and then stored in the name field Recall, when the super class has a
parameterized constructor, the sub-classes will need to call it AND the sub- classes will need to
also provide a constructor without parameters This abstract class will implement the compareTo
method passed on from the Shape interface and will pass on the responsibility of implementing
calculateArea to the extending sub-classes (compare To will use the calculateArea method when
comparing 2 Shape objects). Along with compare To, one more concrete method should be
included. The following will be used by the sub-classes\' toString method: public String
getName) II Simply returns the name field data
Solution
in7.txt
4.4
2.5 3
8.1 3.0 5.0
2.5 3 4
2.5
tuesday
-7
1.0
3 three
3 -9
3 5
1.0
Assignment7.java
import java.io.*;
import java.util.*;
public class Assignment7 {
/**
* This is the test driver class that will include main.
* This program MUST read a file named in7.txt and
* generate an output file named out7.txt. The in7.txt
* file must be created by you based on formatting
* described shortly.
*
* @param theArgs
*/
public static void main(String[] theArgs) {
List myList = new Arra.
Step 1 The Pair Class Many times in writing software we come across p.pdfformaxekochi
Step 1 The Pair Class Many times in writing software we come across problems that require us
of values. For to store a pair example, a coordinate system would require an x, y value pair or a
hash key value pair Your task on this assignment is table as a data, one type but to create a
simple template pair class called Pair that has two type parameters. You should call these
parameters F and s. Functionality Constructor You should create a working constructor that takes
two type parameters one for each of the pair values. get First This is an accessor method that will
return the first of the pair values. get second This is an accessor method that will return the
second of the pair values. set First This is a mutator method that will set the first pair value
setsecond This is a mutator method that will set the second pair value
Solution
Pair.java
public class Pair {
private F first; //first member of pair
private S second; //second member of pair
public Pair(F first, S second) {
this.first = first;
this.second = second;
}
public void setFirst(F first) {
this.first = first;
}
public void setSecond(S second) {
this.second = second;
}
public F getFirst() {
return first;
}
public S getSecond() {
return second;
}
}
LinkedList.java
template class Node
{
private T data; //the object information
private Node* next; //pointer to the next node element
public void setData(T val)
{
this.data = val;
}
public void setNextNull()
{
this.next = NULL;
}
public void setNext(Node *tmp)
{
this.next = tmp;
}
public Node* getNext()
{
return this.next;
}
};
template class LinkedList extends Node
{
private Node *head = new Node;
private Node *tail = new Node;
public LinkedList()
{
head = NULL;
tail = NULL;
}
public ~LinkedList()
{
}
//Method adds info to the end of the list
public void append(T info)
{
if(head == NULL) //if our list is currently empty
{
head = new Node; //Create new node of type T
head->setData(info);
tail = head;
}
else //if not empty add to the end and move the tail
{
Node* temp = new Node;
temp->setData(info);
temp->setNextNull();
tail->setNext(temp);
tail = tail->getNext();
}
}
public void addFront(T info)
{
if(head == NULL) //if our list is currently empty
{
head = new Node; //Create new node of type T
head->setData(info);
tail = head;
}
else //if not empty add to the end and move the tail
{
Node* temp = new Node;
temp->setData(info);
temp->setNext(head);
head = temp;
}
}
//insert after given node
public void insert(Node *node,T info)
{
Node *temp = new Node;
temp->setData(info);
temp->setNext(node->getNext());
node->setNext(temp);
}
public void delete(Node *node)
{
Node *temp = new Node;
temp = head;
while(temp->getNext() != node && temp->getNext() )
{
temp = temp->getNext();
}
if(temp)
{
temp->setNext(node->getNext());
delete node;
}
}
public Integer size(Node *head)
{
int sz=0;
Node * temp = new Node;
temp = head;
while(temp)
{
sz++;
temp = temp->getNext();
}
return sz;
}
}
PairList.java
public class PairList< E, F > extends LinkedList< Pair< E,.
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfaromanets
Creat Shape classes from scratch DETAILS You will create 3 shape classes (Circle, Rectangle,
Triangle) that all inherit from a single abstract class called AbstractShape which implements
Shape (also created by you). You are also responsible for creating the driver class
\"Assignment7.java\" (program that tests your classes and described on page 3) which does the
following reads input data from a file instantiates various objects of the three shapes based on the
input data stores each in a LinkedList outputs this list to an output file sorts a \"copy\" of this
LinkedList of objects outputs the sorted version of the list to the output file outputs the original
list to the output file This driver program also needs to \"ignore errors in the input file that breach
the specified input format as described in the Assianment7,java details (see page 3 1. Shape.java
This is an interface that has 2 abstract methods, and passes the responsibility of implementing the
compareTo method to the class that implements Shape (you may note, nomally Comparable is
\"implemented\" by a class. However, an interface cannot implement because interfaces can only
contain abstract methods. That said, an interface can only extend other interfaces and the
responsibility of actually \"implementing\" the abstract method(s) of the super class interface is
passed on to the sub-classes) public interface Shape extends Comparable public double
calculateAreal) Il This abstract method is implemented at the concrete level public Shape
copyShape); Il also implemented at the concrete level 2. AbstractShape.java public abstract class
AbstractShape implements Shape This class should contain an instance field to store the name of
each obiect. The constructor which sets this field should receive the name and a number to be
concatenated to the name and then stored in the name field Recall, when the super class has a
parameterized constructor, the sub-classes will need to call it AND the sub- classes will need to
also provide a constructor without parameters This abstract class will implement the compareTo
method passed on from the Shape interface and will pass on the responsibility of implementing
calculateArea to the extending sub-classes (compare To will use the calculateArea method when
comparing 2 Shape objects). Along with compare To, one more concrete method should be
included. The following will be used by the sub-classes\' toString method: public String
getName) II Simply returns the name field data
Solution
in7.txt
4.4
2.5 3
8.1 3.0 5.0
2.5 3 4
2.5
tuesday
-7
1.0
3 three
3 -9
3 5
1.0
Assignment7.java
import java.io.*;
import java.util.*;
public class Assignment7 {
/**
* This is the test driver class that will include main.
* This program MUST read a file named in7.txt and
* generate an output file named out7.txt. The in7.txt
* file must be created by you based on formatting
* described shortly.
*
* @param theArgs
*/
public static void main(String[] theArgs) {
List myList = new Arra.
Step 1 The Pair Class Many times in writing software we come across p.pdfformaxekochi
Step 1 The Pair Class Many times in writing software we come across problems that require us
of values. For to store a pair example, a coordinate system would require an x, y value pair or a
hash key value pair Your task on this assignment is table as a data, one type but to create a
simple template pair class called Pair that has two type parameters. You should call these
parameters F and s. Functionality Constructor You should create a working constructor that takes
two type parameters one for each of the pair values. get First This is an accessor method that will
return the first of the pair values. get second This is an accessor method that will return the
second of the pair values. set First This is a mutator method that will set the first pair value
setsecond This is a mutator method that will set the second pair value
Solution
Pair.java
public class Pair {
private F first; //first member of pair
private S second; //second member of pair
public Pair(F first, S second) {
this.first = first;
this.second = second;
}
public void setFirst(F first) {
this.first = first;
}
public void setSecond(S second) {
this.second = second;
}
public F getFirst() {
return first;
}
public S getSecond() {
return second;
}
}
LinkedList.java
template class Node
{
private T data; //the object information
private Node* next; //pointer to the next node element
public void setData(T val)
{
this.data = val;
}
public void setNextNull()
{
this.next = NULL;
}
public void setNext(Node *tmp)
{
this.next = tmp;
}
public Node* getNext()
{
return this.next;
}
};
template class LinkedList extends Node
{
private Node *head = new Node;
private Node *tail = new Node;
public LinkedList()
{
head = NULL;
tail = NULL;
}
public ~LinkedList()
{
}
//Method adds info to the end of the list
public void append(T info)
{
if(head == NULL) //if our list is currently empty
{
head = new Node; //Create new node of type T
head->setData(info);
tail = head;
}
else //if not empty add to the end and move the tail
{
Node* temp = new Node;
temp->setData(info);
temp->setNextNull();
tail->setNext(temp);
tail = tail->getNext();
}
}
public void addFront(T info)
{
if(head == NULL) //if our list is currently empty
{
head = new Node; //Create new node of type T
head->setData(info);
tail = head;
}
else //if not empty add to the end and move the tail
{
Node* temp = new Node;
temp->setData(info);
temp->setNext(head);
head = temp;
}
}
//insert after given node
public void insert(Node *node,T info)
{
Node *temp = new Node;
temp->setData(info);
temp->setNext(node->getNext());
node->setNext(temp);
}
public void delete(Node *node)
{
Node *temp = new Node;
temp = head;
while(temp->getNext() != node && temp->getNext() )
{
temp = temp->getNext();
}
if(temp)
{
temp->setNext(node->getNext());
delete node;
}
}
public Integer size(Node *head)
{
int sz=0;
Node * temp = new Node;
temp = head;
while(temp)
{
sz++;
temp = temp->getNext();
}
return sz;
}
}
PairList.java
public class PairList< E, F > extends LinkedList< Pair< E,.
AnswerNote Provided code shows several bugs, hence I implemented.pdfanurag1231
Answer:
Note: Provided code shows several bugs, hence I implemented a separate code as per the given
program specifications
Program code:
import java.util.Scanner;
//declares fraction class
class Fraction
{
//private data members for the class
private int numerators,denominators;
//default constructor
public Fraction()
{
}
//parameterised constructor for the class
public Fraction(int numerators, int denominators)
{
//assigns numerator
this.numerators = numerators;
//checks the denominator
if(denominators == 0)
{
System.out.println(\"denominator Shouldn\'t be ZERO \");
System.out.println(\"Program Exiting.....\");
System.exit(0);
}
this.denominators = denominators;
}
//parameterised constructor
public Fraction(int numerators)
{
this.numerators = numerators;
}
//method TO string
public String toString()
{
return \"\"+numerators+\" / \"+denominators;
}
//methods Equals()
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Fraction other = (Fraction) obj;
if (this.numerators != other.numerators) {
return false;
}
if (this.denominators != other.denominators) {
return false;
}
return true;
}
//method GCD declaration
public int GCD(int a, int b)
{
//declares local variables
int x = 0, GCD = 0;
int max = a > b ? a : b;
int min = a < b ? a : b;
for(int i = 1; i <= min; i++)
{
x = max * i;
if(x % min == 0)
{
GCD = x;
break;
}
}
//returns GCD
return GCD;
}
//Method to read
public static Fraction read()
{
Scanner sc1 = new Scanner(System.in);
System.out.print(\"Enter Fraction numerators : \");
int num1 = sc1.nextInt();
System.out.print(\"Enter Fraction denominators : \");
int den1 = sc1.nextInt();
System.out.println();
Fraction f1 = new Fraction(num1,den1);
return f1;
}
//Method definition to add()
public Fraction add(Fraction other1)
{
int GCD = GCD(this.denominators,other.denominators);
int numb1 = this.numerators * (GCD/this.denominators);
int numb2 = other1.numerators *(GCD/other.denominators);
int num1 = 0, den1 = 0;
num1 = numb1 + numb2;
den1 = GCD;
return new Fraction(num1,den1);
}
//method definition to add()
public Fraction add(int temp1)
{
//defines the number variable
int num1 = this.denominators * temp1 + this.numerators;
return new Fraction(num1,this.denominators);
}
//method definition to subract
public Fraction subtract(Fraction other1)
{
int GCD = GCD(this.denominators,other.denominators);
int numb1 = this.numerators *(GCD/this.denominators);
int numb2 = other1.numerators *(GCD/other1.denominators);
int num1 = 0, den1 = 0;
num1 = numb1 - numb2;
den1 = GCD;
return new Fraction(num1,den1);
}
//Method definition to multiply
public Fraction multiply(Fraction other1)
{
int num1 = 0, den1 = 0;
num1 = this.numerators * other1.numerators;
den1 = this.denominators * other1.denominators;
return new Fraction(num1,den1);
}
//method definition to Multiply
public Fraction multiply(int temp1)
{
int num 1= this.numerators * temp1;
return new Fraction(num1,this.denomina.
To write a program that implements the following C++ concepts 1. Dat.pdfSANDEEPARIHANT
To write a program that implements the following C++ concepts 1. Data Encapsulation 2.
Instantiate classes 3. Composition Class 4. Aggregation Class 5. Dynamic Memory 6. File
Stream Make a program that reads a file and can generate reports. Each file will have phone calls
records (see section 4). The program will process the data gathering all minutes and total amount
for each report. The program should have a menu (see section 1): 1. New Report – this option
will ask a file name (TE??????.tel). This option will instantiate an object of Report class, loading
the whole file into memory. 2. Delete a report – this option will display all reports available in
memory and ask which one you would like to delete. 3. Display a report – this option will
display all reports available in memory and ask you which one you would like to generate a
report. 4. Exit – Program ends. For option 1, you do not know how many reports are, meaning
that you will create dynamically the reports. For long distance calls the formula will be (minutes
call x $1.50). For local phone calls the formula will be (minutes call x $0.25)
--------------------------------------------------------------------------------------------------------------------
----------------------------
//Main.cpp
*#define between(x,y,z) ((x>=y && x<=z)? true:false)
#include
#include
#include
#include \"Data.h\"
#include \"Report.h\"
#include \"Menu.h\"
using namespace std;
//uses class Report to create reports
//uses class Menu to display a menu to choose
int main() {
int idx = 0;
int count = idx;
Menu menu(\"Reports\");
Data temp;
string fileName;
Report* phoneCompany;
Report* newReport(Report*, int&);
Report* deleteReport(Report*, int&, int);
int displayReport(Report*, int);
bool fileNameExists(string);
menu.addMenuItem(\"New Report\");
menu.addMenuItem(\"Delete a Report\");
menu.addMenuItem(\"Display a Report\");
ofstream openFile;
phoneCompany = NULL;
phoneCompany = new Report[count];
do {
cout << menu;
cin >> menu;
switch (menu.getChoice()) {
case \'1\':
cout << \"\ \\tEnter report name (TE??????): \";
cin >> fileName;
openFile.open(fileName + \".tel\");
if (openFile.good()) {
cout << \"\ \\tReport succesfully created.\ \";
phoneCompany[count].setFileName(fileName);
count++;
}
else {
cout << \"\ \\terror: Could not create report.\ \";
}
break;
case \'2\':
if (count != 0) {
do {
system(\"cls\");
cout << \"\ \ \\tDelete a Report:\ \ \";
idx = displayReport(phoneCompany, count);
if (between(idx, 0, count - 1)) {
phoneCompany = deleteReport(phoneCompany, count, idx);
idx = 0;
}
else
cout << \"\ \\terror: Report could not be deleted.\ \";
} while (idx != count);
}
else {
cout << \"\ \ \\tNo reports to delete.\ \ \";
system(\"pause\");
}
break;
case \'3\':
if (count != 0) {
do {
system(\"cls\");
cout << \"Display a Report:\ \ \";
idx = displayReport(phoneCompany, count);
system(\"cls\");
cout << \"\ \\t\" << phoneCompany[idx].getFileName();
cout << \"\ \ \\tWould you like to edit the report?\";
cout << \.
OrderTest.javapublic class OrderTest { Get an arra.pdfakkhan101
OrderTest.java
public class OrderTest {
/**
* Get an array of specified size and pass it to Order.order().
* Report the results.
*/
public static void main(String[] args) {
if (args.length != 1) {//1
System.out.println(\"Usage: java OrderTest sizeOfArray\ \"
+ \"\\tor\ \\tjava OrderTest arrayFile\");
System.exit(1);
}
// create or read the int[]
int size = 0;
int[] array = new int[0];//5
try {
size = Integer.parseInt(args[0]);
array = ArrayOfInts.randomizedArray(size);
} catch (NumberFormatException nfe) {//8
try {
array = ArrayOfInts.arrayFromFile(args[0]);
size = array.length;
} catch (Exception e) {
System.err.println(\"unable to read array from \" + args[0]);
System.exit(1);//14
}
}
System.out.println(\"before:\");//15
for (int i = 0; i < array.length; i++) {//2 n
System.out.printf(((i+1) % 10 > 0) ? \" %d\" : \" %d\ \", array[i]);//1
}
int myNum = Order.order(array); //this is the call we want to measure
System.out.println(\"\ after:\");//18
for (int i = 0; i < array.length; i++) {//2 n
System.out.printf(((i+1) % 10 > 0) ? \" %d\" : \" %d\ \", array[i]);
}
System.out.println(myNum);
}
}
ArrayOfInts.java
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.Scanner;
public class ArrayOfInts {
/**
* Returns an array of consecutive ints from 1 to size.
*/
public static int[] orderedArray(int size) {
int[] a = new int[size];
for (int i = 0; i < size; i++) {
a[i] = i+1;
}
return a;
}
/**
* Returns a randomized array containing ints from 1 to size.
*/
public static int[] randomizedArray(int size) {
ArrayList aL = new ArrayList();
for (int i = 0; i < size; i++) {
aL.add(i+1);
}
Collections.shuffle(aL);
int[] a = new int[size];
for (int i = 0; i < size; i++) {
a[i] = aL.get(i);
}
return a;
}
/**
* Writes an int[] to a plain-text file with ints separated by spaces.
* Useful for creating input files for repeatable tests.
*/
public static void arrayToFile(int[] array, String outfile) {
try {
FileWriter fw = new FileWriter(outfile);
BufferedWriter bw = new BufferedWriter(fw);
PrintWriter outFile = new PrintWriter(bw);
for (int i : array) {
outFile.print(i + \" \");
}
outFile.close();
} catch (IOException e) {
System.err.println(\"Could not write to \" + outfile + \"\ \" + e);
}
}
/**
* Read ints from a file and return them in an int[]
*/
public static int[] arrayFromFile(String infile) throws FileNotFoundException,
InputMismatchException {
Scanner scan = new Scanner(new File(infile));
ArrayList aL = new ArrayList();
while (scan.hasNext()) {
aL.add(scan.nextInt());
}
scan.close();
int[] a = new int[aL.size()];
for (int i = 0; i < a.length; i++) {
a[i] = aL.get(i);
}
return a;
}
}
Order.java
public class Order {
/**
* Take an int[] and reorganize it so they are in ascending order.
*/
public static int order(int[] array) .
The purpose of this C++ programming project is to allow the student .pdfRahul04August
The purpose of this C++ programming project is to allow the student to perform parallel array
and multidimensional array processing. The logic for string and Cstring has already been
completed, so the assignment can be started before we actually cover string and Cstring in detail.
This program has the following three menu options:
Solution
/*
This program uses simple arrays, multidimensional arrays, cstrings, strings, and files.
It allows a payroll clerk to choose an option from a menu. The choices are:
A: List the Payroll Information by Employee Name
B: Search Payroll Information by Employee Name
X: Exit the Payroll Information Module
The following items for each employee are saved in the file p10.txt:
Employee ID (1000 - 9999)
Last Name (15 characters)
First Name (15 characters)
Rate (5.00 - 10.00)
Hours W1,W2,W3,W4 (0-60)
*/
#include // file processing
#include // cin and cout
#include // toupper
#include // setw
#include // cstring functions strlen, strcmp, strcpy stored in string.h
#include // string class
#define stricmp strcasecmp
#define strnicmp strncasecmp
using namespace std;
//Disable warning messages C4267 C4996.
//To see the warnings, comment out the following line.
//#pragma warning( disable : 4267 4996)
//Warning C4267: coversion from size_t to int, possible lost of data
//size_t is a data type defined in and is an unsigned integer.
//The function strlen returns a value of the type size_t, but in
//searchByName we assign the returned value to an int.
//We could also declare the variable as size_t instead of int.
// size_t stringLength;
//Warning C4996: strnicmp strcpy, stricmp was declared deprecated, means
//the compiler encountered a function that was marked with deprecated.
//The deprecated function may no longer be supported in a future release.
//Global Constants
//When using to declare arrays, must be defined with const modifier
const int ARRAY_SIZE = 20, HOURS_SIZE = 4, NAME_SIZE = 16;
//Declare arrays as global so we don\'t have to pass the arrays to each function.
//Normally we wouldn\'t declare variables that change values a global.
int employeeId[ARRAY_SIZE];
string firstName[ARRAY_SIZE];
char lastName[ARRAY_SIZE][NAME_SIZE];
double rate[ARRAY_SIZE];
int hours[ARRAY_SIZE][HOURS_SIZE];
int numberOfEmps; //count of how many employees were loaded into arrays
int sumHours[ARRAY_SIZE] = {0}; //initialize arrays to zero by providing a
double avgHours[ARRAY_SIZE] = {0}; //value for the first element in the array
//Function Prototypes
void loadArray( );
void sumAndComputeAvgHours( );
void listByName( );
void searchByName( );
void sortByName( );
void swapValues(int i, int minIndex);
void listEmployees( );
void listEmployeesHeadings( );
void listEmployeesDetails(int i);
void listEmployeesTotals( );
void displayContinuePrompt( );
//Program starts here
int main()
{
//Declare and initialize local main variables
char choice; //menu option
//Load the arrays with data
loadArray();
//Sum and compute the average hours
sumAndComputeAv.
Table.java Huffman code frequency tableimport java.io.;im.docxMARRY7
// Table.java: Huffman code frequency table
import java.io.*;
import java.util.TreeSet
class Table {
public final int MAXT = 100; // maximum number of different symbols
public int currTableSize; // current size as table is constructed
public Entry[] tab; // the table array, not allocated
private Reader in; // internal file name for input stream
String file = ""; // the whole input file as a String
private boolean fileOpen = false; // is the file open yet?
private String fileName; // name of input file, if present
private int totalChars = 0; // total number of chars read
char markerChar = '@'; // sentinal at end of file
// Table: constructor, input parameter: input file name or null
public Table(String f) {
fileName = f;
currTableSize = 0;
tab = new Entry[MAXT];
}
// dumpTable: debug dump of contents of Table
public void dumpTable() {
int i;
System.out.println("\nDump of Table ----->");
System.out.println(" Size: " + currTableSize);
for (i = 0; i < currTableSize; i++) {
System.out.println("Entry " + i + ". Symbol: " +
tab[i].symb + ", Weight: " + tab[i].weight +
", Representation: " + tab[i].rep);
}
System.out.println("----> End Dump of Table\n");
}
// getNextChar: fetches next char. Also opens input file
private char getNextChar() {
char ch = ' '; // = ' ' to keep compiler happy
if (!fileOpen) {
fileOpen = true;
if (fileName == null)
in = new InputStreamReader(System.in);
else {
try {
in = new FileReader(fileName);
} catch (IOException e) {
System.out.println("Exception opening " + fileName);
}
}
}
try {
ch = (char)in.read();
} catch (IOException e) {
System.out.println("Exception reading character");
}
return ch;
}
// buildFromFile: read file and build the map of the character frequencies
private void buildFromFile(File file) throws FileNotFoundException {
//
Map<String, Integer> freqMap = new BSTMap<String, Integer>();Scanner scanner = new Scanner(file);
scanner.useDelimiter("");
String character;
while (scanner.hasNext()){
character = scanner.next();
Integer count = freqMap.get(character);
if (count == null){
count = Integer.valueOf(0);
}
freqMap.put(character, count+1);
}
// for each key, make a tree and load it into the priority queue
PriorityQueue<BinaryTree<CountPair>> treeQueue = new PriorityQueue<BinaryTree<CountPair>>(freqMap.keySet().size(), new CountPairTreeComparator
BinaryTree<CountPair> tmpTree;
for (String key: freqMap.keySet()){
int frequency = freqMap.get(key);
tmpTree = new BinaryTree<CountPair>(null, new CountPair(key, frequency), null);
treeQueue.add(tmpTree);
}
Public interface Map<K extends Comparable<K>,V>
{
//This should load the value value into the map at the location //associated with the key, ...
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdfformicreation
Assignment is :
\"Page 349-350 #4 and #5 Use the \"Linked List lab\" you have been working on in class and add
the two functions the questions are asking you to develop: divideMid and divideAt. Be sure to
include comments Use meaningful identifier names (constants where appropriate) Do not work
together; no two people should have identical work!?!? Turn in .cpp file AND Turn in a \"print-
screen\' of your output (press \"print-screen\' on keyboard, then \'paste\' in MS-Word)\"
How do you solve QUESTION #5 in the book data structures using c++ by D.S. Malik in Visiual
Studios using the linked list below with what is being asked? Please need help
Linked list :
#include
#include
using namespace std;
struct nodeType
{
int info;
nodeType *link;
};
void createList(nodeType*& first, nodeType*& last);
void printList(nodeType*& first);
void insertFront(nodeType*& first);
void insertBack(nodeType*& last);
void deleteFirst(nodeType*& first);
void deleteLast(nodeType*& last, nodeType* first);
int main()
{
nodeType *first, *last;
int num;
createList(first, last);
int choice;
while(true)
{
cout<<\"1. Insert Front.\ 2. Insert Last.\ 3. Delete Front.\ 4. Delete Last.\ 5. Print List.\ 6. Exit.\
\";
cout<<\"Enter your choice: \";
cin>>choice;
switch(choice)
{
case 1: insertFront(first); break;
case 2: insertBack(last); break;
case 3: deleteFirst(first); break;
case 4: deleteLast(last, first); break;
case 5: printList(first); break;
case 6: return 0;
default: cout<<\"Invalid menu option. Try again.\"<>number;
while (number != -999)
{
newNode = new nodeType; // create new node
newNode->info = number;
newNode->link = NULL;
if (first == NULL)
{
first = newNode;
last = newNode;
}
else
{
last->link = newNode;
last = newNode;
}
cout<<\"Enter an integer (-999 to stop): \";
cin>>number;
} // end of while-loop
} // end of build list function
void deleteFirst(nodeType*& first)
{
nodeType *temp;
temp= first;
first= temp->link;
delete temp;
return;
}
void deleteLast(nodeType*& last, nodeType* current)
{
nodeType *temp;
while(current->link != NULL)
{
temp=current;
current=current->link;
}
temp=last;
current->link=NULL;
delete temp;
last = current;
return;
}
void insertFront(nodeType*& front)
{
int num;
cout<<\"\ Enter the number to insert: \";
cin>>num;
nodeType *newNode = new nodeType;
newNode->info=num;
newNode->link= front;
front= newNode;
return;
}
void insertBack(nodeType*& last)
{
int num;
cout<<\"\ Enter the number to insert: \";
cin>>num;
nodeType *newNode = new nodeType;
newNode->info=num;
newNode->link= NULL;
last->link= newNode;
last = newNode;
return;
}
void printList(nodeType*& first)
{
cout<<\"Inside printList...printing linked list...\ \"<info << \" \";
current = current->link;
}
cout<
#include
using namespace std;
struct nodeType
{
int info;
nodeType *link;
};
void createList(nodeType*& first, nodeType*& last);
void printList(nodeType*& first);
void insertFront(nodeType*& first);
void insertBack(nodeType*& last);
void deleteFirst(nodeType*& first);
void dele.
HELP IN JAVACreate a main method and use these input files to tes.pdffatoryoutlets
For the questions below, use the W3Schools customer orders database. You need to submit
thoroughly tested SQL statements. For your convenience and reference, relevant data model is
attached as a PDF document with the assignment in the Blackboard. Name of this document is
\"Relationship diagram for W3schools order pdf.\" 1) Write a query to show Customers\' Country
wise sales totals. Your query should show Customers\' Country name and the total sale value for
that Country 2) Write a query to show Product wise sales totals. Your query should Product
name and the total sale value for that Product. 3) Write a query to show the number of orders for
each shipper. Your query should show shipper name and the count of orders with the shipper. 4)
Write a query to show number of products in each product category. Your query should show
Category name and number of products in that category 5) Write a query that shows Customers\'
country wise customer count, and order count. Your query should show country name, total
number of customers from that country, and total number of orders from the customers of that
country 6) Write a query that shows the number of products supplied by each Supplier. Your
query should show Country name, supplier name and the count of products supplied by that
supplier. Note: Sale Price Orderdetails.Quantity Products.price (see an example in the class
slides deck) W3SCHOOLS SQL is located at http://www.w3schools.com/sql/default.asp
(Preferred browser is Chrome). On this page you will find a button called \"Try it yourself\".
Click on that button. You will be redirected to a page where you see a list of tables on the right
side of the page. It is highly recommended to click \'Restore Database\' button on this page
during every session. The page contains a box where you can type in an SQL statement
involving the listed tables. You type in your SQL statement in that box and click on \"Run
SQL\'\' button. The results will be displayed if your SQL statement is syntactically correct.
Solution
1. SELECT Customers.Country, SUM(OrderDetails.Quantity * Products.Price) AS Total_Sale
FROM Customers
LEFT JOIN Orders ON Customers.CustomerID=Orders.CustomerID
LEFT JOIN OrderDetails ON Orders.OrderId=OrderDetails.OrderId
LEFT JOIN Products ON OrderDetails.ProductId=Products.ProductId
Group BY Customers.Country;
2. SELECT Products.ProductName, SUM(OrderDetails.Quantity * Products.Price) AS
Total_Sale FROM Customers
LEFT JOIN Orders ON Customers.CustomerID=Orders.CustomerID
LEFT JOIN OrderDetails ON Orders.OrderId=OrderDetails.OrderId
LEFT JOIN Products ON OrderDetails.ProductId=Products.ProductId
Group BY Products.ProductName;
You can edit these query to get other results set..
Not so long ago Microsoft announced a new language trageting on front-end developers. Everybody's reaction was like: Why?!! Is it just Microsoft darting back to Google?!
So, why a new language? JavaScript has its bad parts. Mostly you can avoid them or workaraund. You can emulate class-based OOP style, modules, scoping and even run-time typing. But that is doomed to be clumsy. That's not in the language design. Google has pointed out these flaws, provided a new language and failed. Will the story of TypeScript be any different?
JAVA OOP project; desperately need help asap im begging.Been stuck.pdffantasiatheoutofthef
JAVA OOP project; desperately need help asap im begging.
Been stuck on this for a week since my OOP skills are not good at all. Due in a couple hours so
im desperate. Codes needed will be provided at the end, thank you.
Codes:
DotChaser.java:
import java.util.*;
public class DotChaser {
public static Random rand = new Random(System.currentTimeMillis());
/**
* A "Thing" moves in a grid world. A TypeA Thing randomly
* decides to turn left or right (or not turn) every "round",
* and, afterward, takes a step forward. A TypeB Thing
* only considers making a random turn every 10th round.
*
* A STATIC CLASS? OH NO! GET IT OUT OF HERE!
*/
public static class Thing {
// dir: 0=North, 1=East, 2=South, 3=West.
// timeSinceLast: this is only important for "TypeB" Things.
public int row, col, dir, timeSinceLast;
public char lab = 'r';
public boolean isTypeB;
}
/**
* YOU'LL NEED TO PUT THIS SOMEWHERE ELSE
* HINT: WOULDN'T IT BE NICE TO HAVE A LIST OR QUEUE SO THAT
* WE DON'T HAVE TO USE NODES HERE?
* This class is for linked lists of Thing's
*/
public static class Node {
public Thing data;
public Node next;
}
// EEEEEK! STATIC METHODS!!! PLEASE FIND THEM A BETTER HOME.
public static void rightTurn(Thing t) {
t.dir = (t.dir + 1) % 4;
}
public static void leftTurn(Thing t) {
t.dir = (t.dir + 3) % 4;
}
public static void maybeTurn(Thing t) {
int i = rand.nextInt(3);
if (t.isTypeB) {
t.timeSinceLast++;
if (t.timeSinceLast == 10) {
t.timeSinceLast = 0;
if (i == 1) {
rightTurn(t);
}
if (i == 2) {
leftTurn(t);
}
}
} else {
if (i == 1) {
rightTurn(t);
}
if (i == 2) {
leftTurn(t);
}
}
}
public static void step(Thing t) {
final int[] dc = {
0, 1, 0, -1
}, dr = {
1, 0, -1, 0
};
t.row += dr[t.dir];
t.col += dc[t.dir];
}
/**
* This static method is ok :)
*/
public static void main(String[] args) {
int N = 200;
if( args.length != 0 )
N = Integer.parseInt(args[0]);
// INSTEAD OF A NODE, CREATE SOMETHING MORE USER-FRIENDLY.
Node L = null;
int count = 0;
while( true ) {
// Every N rounds, add another typeA and typeB Thing.
if( count % N == 0 ) {
// Add a typeA thing to the list.
// (GEE, THAT'S A LOT OF CODE FOR JUST CREATING ONE THING)
Thing tA = new Thing();
tA.row = 45;
tA.col = 50;
Node nA = new Node();
nA.data = tA;
nA.next = L;
L = nA;
// Add a typeB thing to the list
Thing tB = new Thing();
tB.row = 55;
tB.col = 50;
tB.lab = 'b';
tB.isTypeB = true;
Node nB = new Node();
nB.data = tB;
nB.next = L;
L = nB;
}
// Print out each thing.
// (SEEMS LIKE A NICE PRINTALL() METHOD CALL WOULD WORK HERE)
// (SEEMS LIKE A toString() METHOD IN THE CLASS WOULD ALSO BE NICE)
for( Node T = L; T != null; T = T.next )
System.out.println(T.data.row + " " + T.data.col + " " + T.data.lab);
System.out.println("done");
System.out.flush();
// Move each thing.
// (SEEMS LIKE A NICE MOVEALL() METHOD CALL WOULD WORK HERE)
for( Node T = L; T != null; T = T.next ) {
maybeTurn(T.data);
step(T.data);
}
count++;
}
}
}
Lab2_Tester.java
import org.junit.Test;
import static org.junit.Assert.assertEqual.
In class, we talked about all sorts of experiments. I would like to s.pdfAroraRajinder1
In class, we talked about all sorts of experiments. I would like to sum them up here. For each of
the following, name and briefly describe an experiment that... (a)...demonstrates that light
behaves like a wave. (b)...demonstrates that light behaves like particles. (c)...demonstrates that
electrons behave like particles. (d)...demonstrates that electrons behave like a wave.
Solution
a) Young\'s Double-Slit Experiment
A definitive experiment was Young\'s double slit experiment, which demonstrated that light
shined at two slits in a screen show an interference pattern characteristic of waves of light, rather
than particles. The principle behind this phenomenon is diffraction of light due to this any point
source of light spreads and behaves like a light source.
In the early 19th century, English scientist Thomas Young carried out the famous double-slit
experiment (also known as Young\'s experiment), which demonstrated that a beam of light, when
split into two beams and then recombined, will show interference effects that can only be
explained by assuming that light is a wavelike disturbance. If light consisted strictly of ordinary
or classical particles, and these particles were fired in a straight line through a slit and allowed to
strike a screen on the other side, we would expect to see a pattern corresponding to the size and
shape of the slit. However, when this single-slit experiment is actually performed, the pattern on
the screen is a diffraction pattern in which the light is spread out. The smaller the slit, the greater
the angle of spread.Similarly, if light consisted strictly of classical particles and we illuminated
two parallel slits, the expected pattern on the screen would simply be the sum of the two single-
slit patterns. In actuality, however, the pattern changes to one with a series of alternating light
and dark bands. When Thomas Young first demonstrated this phenomenon, it indicated that light
consists of waves, as the distribution of brightness can be explained by the alternately additive
and subtractive interference of wavefronts.
b) Photoelectric effect Experiment
When light is shined on clean sodium metal in vacuum then ejection of electrons was observed.
Analysis of data from the photoelectric experiment showed that the energy of the ejected
electrons was proportional to the frequency of the illuminating light. This showed that whatever
was knocking the electrons out had an energy proportional to light frequency. The remarkable
fact that the ejection energy was independent of the total energy of illumination showed that the
interaction must be like that of a particle which gave all of its energy to the electron!
c) and d) Feynman\'s double-slit experiment
In Feynman\'s double-slit thought-experiment, a specific material is randomly directed at a wall
which has two small slits that can be opened and closed at will -- some of the material gets
blocked and some passes through the slits, depending on which ones are open.
Ba.
Jane Lee was employed as a secretary at Burton Trucking. She was fire.pdfAroraRajinder1
Jane Lee was employed as a secretary at Burton Trucking. She was fired when she refused to
perjure herself at a trial where her employer was the defendant. She filed a wrongful discharge
lawsuit against her former employer. Ms. Lee will prevail if the state where the lawsuit was filed
recognizes a public policy exception to the employment-at-will doctrine prevail only if she
proves she was telling the truth will lose because the employment-at-will doctrine completely
insulates the employer from liability will lose because her testimony provided the basis for a
defamation lawsuit by her former employer will prevail under recent amendments to the
Sarbonnes-Oxley Act
Solution.
More Related Content
Similar to Keep getting a null pointer exception for some odd reasonim creati.pdf
AnswerNote Provided code shows several bugs, hence I implemented.pdfanurag1231
Answer:
Note: Provided code shows several bugs, hence I implemented a separate code as per the given
program specifications
Program code:
import java.util.Scanner;
//declares fraction class
class Fraction
{
//private data members for the class
private int numerators,denominators;
//default constructor
public Fraction()
{
}
//parameterised constructor for the class
public Fraction(int numerators, int denominators)
{
//assigns numerator
this.numerators = numerators;
//checks the denominator
if(denominators == 0)
{
System.out.println(\"denominator Shouldn\'t be ZERO \");
System.out.println(\"Program Exiting.....\");
System.exit(0);
}
this.denominators = denominators;
}
//parameterised constructor
public Fraction(int numerators)
{
this.numerators = numerators;
}
//method TO string
public String toString()
{
return \"\"+numerators+\" / \"+denominators;
}
//methods Equals()
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Fraction other = (Fraction) obj;
if (this.numerators != other.numerators) {
return false;
}
if (this.denominators != other.denominators) {
return false;
}
return true;
}
//method GCD declaration
public int GCD(int a, int b)
{
//declares local variables
int x = 0, GCD = 0;
int max = a > b ? a : b;
int min = a < b ? a : b;
for(int i = 1; i <= min; i++)
{
x = max * i;
if(x % min == 0)
{
GCD = x;
break;
}
}
//returns GCD
return GCD;
}
//Method to read
public static Fraction read()
{
Scanner sc1 = new Scanner(System.in);
System.out.print(\"Enter Fraction numerators : \");
int num1 = sc1.nextInt();
System.out.print(\"Enter Fraction denominators : \");
int den1 = sc1.nextInt();
System.out.println();
Fraction f1 = new Fraction(num1,den1);
return f1;
}
//Method definition to add()
public Fraction add(Fraction other1)
{
int GCD = GCD(this.denominators,other.denominators);
int numb1 = this.numerators * (GCD/this.denominators);
int numb2 = other1.numerators *(GCD/other.denominators);
int num1 = 0, den1 = 0;
num1 = numb1 + numb2;
den1 = GCD;
return new Fraction(num1,den1);
}
//method definition to add()
public Fraction add(int temp1)
{
//defines the number variable
int num1 = this.denominators * temp1 + this.numerators;
return new Fraction(num1,this.denominators);
}
//method definition to subract
public Fraction subtract(Fraction other1)
{
int GCD = GCD(this.denominators,other.denominators);
int numb1 = this.numerators *(GCD/this.denominators);
int numb2 = other1.numerators *(GCD/other1.denominators);
int num1 = 0, den1 = 0;
num1 = numb1 - numb2;
den1 = GCD;
return new Fraction(num1,den1);
}
//Method definition to multiply
public Fraction multiply(Fraction other1)
{
int num1 = 0, den1 = 0;
num1 = this.numerators * other1.numerators;
den1 = this.denominators * other1.denominators;
return new Fraction(num1,den1);
}
//method definition to Multiply
public Fraction multiply(int temp1)
{
int num 1= this.numerators * temp1;
return new Fraction(num1,this.denomina.
To write a program that implements the following C++ concepts 1. Dat.pdfSANDEEPARIHANT
To write a program that implements the following C++ concepts 1. Data Encapsulation 2.
Instantiate classes 3. Composition Class 4. Aggregation Class 5. Dynamic Memory 6. File
Stream Make a program that reads a file and can generate reports. Each file will have phone calls
records (see section 4). The program will process the data gathering all minutes and total amount
for each report. The program should have a menu (see section 1): 1. New Report – this option
will ask a file name (TE??????.tel). This option will instantiate an object of Report class, loading
the whole file into memory. 2. Delete a report – this option will display all reports available in
memory and ask which one you would like to delete. 3. Display a report – this option will
display all reports available in memory and ask you which one you would like to generate a
report. 4. Exit – Program ends. For option 1, you do not know how many reports are, meaning
that you will create dynamically the reports. For long distance calls the formula will be (minutes
call x $1.50). For local phone calls the formula will be (minutes call x $0.25)
--------------------------------------------------------------------------------------------------------------------
----------------------------
//Main.cpp
*#define between(x,y,z) ((x>=y && x<=z)? true:false)
#include
#include
#include
#include \"Data.h\"
#include \"Report.h\"
#include \"Menu.h\"
using namespace std;
//uses class Report to create reports
//uses class Menu to display a menu to choose
int main() {
int idx = 0;
int count = idx;
Menu menu(\"Reports\");
Data temp;
string fileName;
Report* phoneCompany;
Report* newReport(Report*, int&);
Report* deleteReport(Report*, int&, int);
int displayReport(Report*, int);
bool fileNameExists(string);
menu.addMenuItem(\"New Report\");
menu.addMenuItem(\"Delete a Report\");
menu.addMenuItem(\"Display a Report\");
ofstream openFile;
phoneCompany = NULL;
phoneCompany = new Report[count];
do {
cout << menu;
cin >> menu;
switch (menu.getChoice()) {
case \'1\':
cout << \"\ \\tEnter report name (TE??????): \";
cin >> fileName;
openFile.open(fileName + \".tel\");
if (openFile.good()) {
cout << \"\ \\tReport succesfully created.\ \";
phoneCompany[count].setFileName(fileName);
count++;
}
else {
cout << \"\ \\terror: Could not create report.\ \";
}
break;
case \'2\':
if (count != 0) {
do {
system(\"cls\");
cout << \"\ \ \\tDelete a Report:\ \ \";
idx = displayReport(phoneCompany, count);
if (between(idx, 0, count - 1)) {
phoneCompany = deleteReport(phoneCompany, count, idx);
idx = 0;
}
else
cout << \"\ \\terror: Report could not be deleted.\ \";
} while (idx != count);
}
else {
cout << \"\ \ \\tNo reports to delete.\ \ \";
system(\"pause\");
}
break;
case \'3\':
if (count != 0) {
do {
system(\"cls\");
cout << \"Display a Report:\ \ \";
idx = displayReport(phoneCompany, count);
system(\"cls\");
cout << \"\ \\t\" << phoneCompany[idx].getFileName();
cout << \"\ \ \\tWould you like to edit the report?\";
cout << \.
OrderTest.javapublic class OrderTest { Get an arra.pdfakkhan101
OrderTest.java
public class OrderTest {
/**
* Get an array of specified size and pass it to Order.order().
* Report the results.
*/
public static void main(String[] args) {
if (args.length != 1) {//1
System.out.println(\"Usage: java OrderTest sizeOfArray\ \"
+ \"\\tor\ \\tjava OrderTest arrayFile\");
System.exit(1);
}
// create or read the int[]
int size = 0;
int[] array = new int[0];//5
try {
size = Integer.parseInt(args[0]);
array = ArrayOfInts.randomizedArray(size);
} catch (NumberFormatException nfe) {//8
try {
array = ArrayOfInts.arrayFromFile(args[0]);
size = array.length;
} catch (Exception e) {
System.err.println(\"unable to read array from \" + args[0]);
System.exit(1);//14
}
}
System.out.println(\"before:\");//15
for (int i = 0; i < array.length; i++) {//2 n
System.out.printf(((i+1) % 10 > 0) ? \" %d\" : \" %d\ \", array[i]);//1
}
int myNum = Order.order(array); //this is the call we want to measure
System.out.println(\"\ after:\");//18
for (int i = 0; i < array.length; i++) {//2 n
System.out.printf(((i+1) % 10 > 0) ? \" %d\" : \" %d\ \", array[i]);
}
System.out.println(myNum);
}
}
ArrayOfInts.java
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.Scanner;
public class ArrayOfInts {
/**
* Returns an array of consecutive ints from 1 to size.
*/
public static int[] orderedArray(int size) {
int[] a = new int[size];
for (int i = 0; i < size; i++) {
a[i] = i+1;
}
return a;
}
/**
* Returns a randomized array containing ints from 1 to size.
*/
public static int[] randomizedArray(int size) {
ArrayList aL = new ArrayList();
for (int i = 0; i < size; i++) {
aL.add(i+1);
}
Collections.shuffle(aL);
int[] a = new int[size];
for (int i = 0; i < size; i++) {
a[i] = aL.get(i);
}
return a;
}
/**
* Writes an int[] to a plain-text file with ints separated by spaces.
* Useful for creating input files for repeatable tests.
*/
public static void arrayToFile(int[] array, String outfile) {
try {
FileWriter fw = new FileWriter(outfile);
BufferedWriter bw = new BufferedWriter(fw);
PrintWriter outFile = new PrintWriter(bw);
for (int i : array) {
outFile.print(i + \" \");
}
outFile.close();
} catch (IOException e) {
System.err.println(\"Could not write to \" + outfile + \"\ \" + e);
}
}
/**
* Read ints from a file and return them in an int[]
*/
public static int[] arrayFromFile(String infile) throws FileNotFoundException,
InputMismatchException {
Scanner scan = new Scanner(new File(infile));
ArrayList aL = new ArrayList();
while (scan.hasNext()) {
aL.add(scan.nextInt());
}
scan.close();
int[] a = new int[aL.size()];
for (int i = 0; i < a.length; i++) {
a[i] = aL.get(i);
}
return a;
}
}
Order.java
public class Order {
/**
* Take an int[] and reorganize it so they are in ascending order.
*/
public static int order(int[] array) .
The purpose of this C++ programming project is to allow the student .pdfRahul04August
The purpose of this C++ programming project is to allow the student to perform parallel array
and multidimensional array processing. The logic for string and Cstring has already been
completed, so the assignment can be started before we actually cover string and Cstring in detail.
This program has the following three menu options:
Solution
/*
This program uses simple arrays, multidimensional arrays, cstrings, strings, and files.
It allows a payroll clerk to choose an option from a menu. The choices are:
A: List the Payroll Information by Employee Name
B: Search Payroll Information by Employee Name
X: Exit the Payroll Information Module
The following items for each employee are saved in the file p10.txt:
Employee ID (1000 - 9999)
Last Name (15 characters)
First Name (15 characters)
Rate (5.00 - 10.00)
Hours W1,W2,W3,W4 (0-60)
*/
#include // file processing
#include // cin and cout
#include // toupper
#include // setw
#include // cstring functions strlen, strcmp, strcpy stored in string.h
#include // string class
#define stricmp strcasecmp
#define strnicmp strncasecmp
using namespace std;
//Disable warning messages C4267 C4996.
//To see the warnings, comment out the following line.
//#pragma warning( disable : 4267 4996)
//Warning C4267: coversion from size_t to int, possible lost of data
//size_t is a data type defined in and is an unsigned integer.
//The function strlen returns a value of the type size_t, but in
//searchByName we assign the returned value to an int.
//We could also declare the variable as size_t instead of int.
// size_t stringLength;
//Warning C4996: strnicmp strcpy, stricmp was declared deprecated, means
//the compiler encountered a function that was marked with deprecated.
//The deprecated function may no longer be supported in a future release.
//Global Constants
//When using to declare arrays, must be defined with const modifier
const int ARRAY_SIZE = 20, HOURS_SIZE = 4, NAME_SIZE = 16;
//Declare arrays as global so we don\'t have to pass the arrays to each function.
//Normally we wouldn\'t declare variables that change values a global.
int employeeId[ARRAY_SIZE];
string firstName[ARRAY_SIZE];
char lastName[ARRAY_SIZE][NAME_SIZE];
double rate[ARRAY_SIZE];
int hours[ARRAY_SIZE][HOURS_SIZE];
int numberOfEmps; //count of how many employees were loaded into arrays
int sumHours[ARRAY_SIZE] = {0}; //initialize arrays to zero by providing a
double avgHours[ARRAY_SIZE] = {0}; //value for the first element in the array
//Function Prototypes
void loadArray( );
void sumAndComputeAvgHours( );
void listByName( );
void searchByName( );
void sortByName( );
void swapValues(int i, int minIndex);
void listEmployees( );
void listEmployeesHeadings( );
void listEmployeesDetails(int i);
void listEmployeesTotals( );
void displayContinuePrompt( );
//Program starts here
int main()
{
//Declare and initialize local main variables
char choice; //menu option
//Load the arrays with data
loadArray();
//Sum and compute the average hours
sumAndComputeAv.
Table.java Huffman code frequency tableimport java.io.;im.docxMARRY7
// Table.java: Huffman code frequency table
import java.io.*;
import java.util.TreeSet
class Table {
public final int MAXT = 100; // maximum number of different symbols
public int currTableSize; // current size as table is constructed
public Entry[] tab; // the table array, not allocated
private Reader in; // internal file name for input stream
String file = ""; // the whole input file as a String
private boolean fileOpen = false; // is the file open yet?
private String fileName; // name of input file, if present
private int totalChars = 0; // total number of chars read
char markerChar = '@'; // sentinal at end of file
// Table: constructor, input parameter: input file name or null
public Table(String f) {
fileName = f;
currTableSize = 0;
tab = new Entry[MAXT];
}
// dumpTable: debug dump of contents of Table
public void dumpTable() {
int i;
System.out.println("\nDump of Table ----->");
System.out.println(" Size: " + currTableSize);
for (i = 0; i < currTableSize; i++) {
System.out.println("Entry " + i + ". Symbol: " +
tab[i].symb + ", Weight: " + tab[i].weight +
", Representation: " + tab[i].rep);
}
System.out.println("----> End Dump of Table\n");
}
// getNextChar: fetches next char. Also opens input file
private char getNextChar() {
char ch = ' '; // = ' ' to keep compiler happy
if (!fileOpen) {
fileOpen = true;
if (fileName == null)
in = new InputStreamReader(System.in);
else {
try {
in = new FileReader(fileName);
} catch (IOException e) {
System.out.println("Exception opening " + fileName);
}
}
}
try {
ch = (char)in.read();
} catch (IOException e) {
System.out.println("Exception reading character");
}
return ch;
}
// buildFromFile: read file and build the map of the character frequencies
private void buildFromFile(File file) throws FileNotFoundException {
//
Map<String, Integer> freqMap = new BSTMap<String, Integer>();Scanner scanner = new Scanner(file);
scanner.useDelimiter("");
String character;
while (scanner.hasNext()){
character = scanner.next();
Integer count = freqMap.get(character);
if (count == null){
count = Integer.valueOf(0);
}
freqMap.put(character, count+1);
}
// for each key, make a tree and load it into the priority queue
PriorityQueue<BinaryTree<CountPair>> treeQueue = new PriorityQueue<BinaryTree<CountPair>>(freqMap.keySet().size(), new CountPairTreeComparator
BinaryTree<CountPair> tmpTree;
for (String key: freqMap.keySet()){
int frequency = freqMap.get(key);
tmpTree = new BinaryTree<CountPair>(null, new CountPair(key, frequency), null);
treeQueue.add(tmpTree);
}
Public interface Map<K extends Comparable<K>,V>
{
//This should load the value value into the map at the location //associated with the key, ...
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdfformicreation
Assignment is :
\"Page 349-350 #4 and #5 Use the \"Linked List lab\" you have been working on in class and add
the two functions the questions are asking you to develop: divideMid and divideAt. Be sure to
include comments Use meaningful identifier names (constants where appropriate) Do not work
together; no two people should have identical work!?!? Turn in .cpp file AND Turn in a \"print-
screen\' of your output (press \"print-screen\' on keyboard, then \'paste\' in MS-Word)\"
How do you solve QUESTION #5 in the book data structures using c++ by D.S. Malik in Visiual
Studios using the linked list below with what is being asked? Please need help
Linked list :
#include
#include
using namespace std;
struct nodeType
{
int info;
nodeType *link;
};
void createList(nodeType*& first, nodeType*& last);
void printList(nodeType*& first);
void insertFront(nodeType*& first);
void insertBack(nodeType*& last);
void deleteFirst(nodeType*& first);
void deleteLast(nodeType*& last, nodeType* first);
int main()
{
nodeType *first, *last;
int num;
createList(first, last);
int choice;
while(true)
{
cout<<\"1. Insert Front.\ 2. Insert Last.\ 3. Delete Front.\ 4. Delete Last.\ 5. Print List.\ 6. Exit.\
\";
cout<<\"Enter your choice: \";
cin>>choice;
switch(choice)
{
case 1: insertFront(first); break;
case 2: insertBack(last); break;
case 3: deleteFirst(first); break;
case 4: deleteLast(last, first); break;
case 5: printList(first); break;
case 6: return 0;
default: cout<<\"Invalid menu option. Try again.\"<>number;
while (number != -999)
{
newNode = new nodeType; // create new node
newNode->info = number;
newNode->link = NULL;
if (first == NULL)
{
first = newNode;
last = newNode;
}
else
{
last->link = newNode;
last = newNode;
}
cout<<\"Enter an integer (-999 to stop): \";
cin>>number;
} // end of while-loop
} // end of build list function
void deleteFirst(nodeType*& first)
{
nodeType *temp;
temp= first;
first= temp->link;
delete temp;
return;
}
void deleteLast(nodeType*& last, nodeType* current)
{
nodeType *temp;
while(current->link != NULL)
{
temp=current;
current=current->link;
}
temp=last;
current->link=NULL;
delete temp;
last = current;
return;
}
void insertFront(nodeType*& front)
{
int num;
cout<<\"\ Enter the number to insert: \";
cin>>num;
nodeType *newNode = new nodeType;
newNode->info=num;
newNode->link= front;
front= newNode;
return;
}
void insertBack(nodeType*& last)
{
int num;
cout<<\"\ Enter the number to insert: \";
cin>>num;
nodeType *newNode = new nodeType;
newNode->info=num;
newNode->link= NULL;
last->link= newNode;
last = newNode;
return;
}
void printList(nodeType*& first)
{
cout<<\"Inside printList...printing linked list...\ \"<info << \" \";
current = current->link;
}
cout<
#include
using namespace std;
struct nodeType
{
int info;
nodeType *link;
};
void createList(nodeType*& first, nodeType*& last);
void printList(nodeType*& first);
void insertFront(nodeType*& first);
void insertBack(nodeType*& last);
void deleteFirst(nodeType*& first);
void dele.
HELP IN JAVACreate a main method and use these input files to tes.pdffatoryoutlets
For the questions below, use the W3Schools customer orders database. You need to submit
thoroughly tested SQL statements. For your convenience and reference, relevant data model is
attached as a PDF document with the assignment in the Blackboard. Name of this document is
\"Relationship diagram for W3schools order pdf.\" 1) Write a query to show Customers\' Country
wise sales totals. Your query should show Customers\' Country name and the total sale value for
that Country 2) Write a query to show Product wise sales totals. Your query should Product
name and the total sale value for that Product. 3) Write a query to show the number of orders for
each shipper. Your query should show shipper name and the count of orders with the shipper. 4)
Write a query to show number of products in each product category. Your query should show
Category name and number of products in that category 5) Write a query that shows Customers\'
country wise customer count, and order count. Your query should show country name, total
number of customers from that country, and total number of orders from the customers of that
country 6) Write a query that shows the number of products supplied by each Supplier. Your
query should show Country name, supplier name and the count of products supplied by that
supplier. Note: Sale Price Orderdetails.Quantity Products.price (see an example in the class
slides deck) W3SCHOOLS SQL is located at http://www.w3schools.com/sql/default.asp
(Preferred browser is Chrome). On this page you will find a button called \"Try it yourself\".
Click on that button. You will be redirected to a page where you see a list of tables on the right
side of the page. It is highly recommended to click \'Restore Database\' button on this page
during every session. The page contains a box where you can type in an SQL statement
involving the listed tables. You type in your SQL statement in that box and click on \"Run
SQL\'\' button. The results will be displayed if your SQL statement is syntactically correct.
Solution
1. SELECT Customers.Country, SUM(OrderDetails.Quantity * Products.Price) AS Total_Sale
FROM Customers
LEFT JOIN Orders ON Customers.CustomerID=Orders.CustomerID
LEFT JOIN OrderDetails ON Orders.OrderId=OrderDetails.OrderId
LEFT JOIN Products ON OrderDetails.ProductId=Products.ProductId
Group BY Customers.Country;
2. SELECT Products.ProductName, SUM(OrderDetails.Quantity * Products.Price) AS
Total_Sale FROM Customers
LEFT JOIN Orders ON Customers.CustomerID=Orders.CustomerID
LEFT JOIN OrderDetails ON Orders.OrderId=OrderDetails.OrderId
LEFT JOIN Products ON OrderDetails.ProductId=Products.ProductId
Group BY Products.ProductName;
You can edit these query to get other results set..
Not so long ago Microsoft announced a new language trageting on front-end developers. Everybody's reaction was like: Why?!! Is it just Microsoft darting back to Google?!
So, why a new language? JavaScript has its bad parts. Mostly you can avoid them or workaraund. You can emulate class-based OOP style, modules, scoping and even run-time typing. But that is doomed to be clumsy. That's not in the language design. Google has pointed out these flaws, provided a new language and failed. Will the story of TypeScript be any different?
JAVA OOP project; desperately need help asap im begging.Been stuck.pdffantasiatheoutofthef
JAVA OOP project; desperately need help asap im begging.
Been stuck on this for a week since my OOP skills are not good at all. Due in a couple hours so
im desperate. Codes needed will be provided at the end, thank you.
Codes:
DotChaser.java:
import java.util.*;
public class DotChaser {
public static Random rand = new Random(System.currentTimeMillis());
/**
* A "Thing" moves in a grid world. A TypeA Thing randomly
* decides to turn left or right (or not turn) every "round",
* and, afterward, takes a step forward. A TypeB Thing
* only considers making a random turn every 10th round.
*
* A STATIC CLASS? OH NO! GET IT OUT OF HERE!
*/
public static class Thing {
// dir: 0=North, 1=East, 2=South, 3=West.
// timeSinceLast: this is only important for "TypeB" Things.
public int row, col, dir, timeSinceLast;
public char lab = 'r';
public boolean isTypeB;
}
/**
* YOU'LL NEED TO PUT THIS SOMEWHERE ELSE
* HINT: WOULDN'T IT BE NICE TO HAVE A LIST OR QUEUE SO THAT
* WE DON'T HAVE TO USE NODES HERE?
* This class is for linked lists of Thing's
*/
public static class Node {
public Thing data;
public Node next;
}
// EEEEEK! STATIC METHODS!!! PLEASE FIND THEM A BETTER HOME.
public static void rightTurn(Thing t) {
t.dir = (t.dir + 1) % 4;
}
public static void leftTurn(Thing t) {
t.dir = (t.dir + 3) % 4;
}
public static void maybeTurn(Thing t) {
int i = rand.nextInt(3);
if (t.isTypeB) {
t.timeSinceLast++;
if (t.timeSinceLast == 10) {
t.timeSinceLast = 0;
if (i == 1) {
rightTurn(t);
}
if (i == 2) {
leftTurn(t);
}
}
} else {
if (i == 1) {
rightTurn(t);
}
if (i == 2) {
leftTurn(t);
}
}
}
public static void step(Thing t) {
final int[] dc = {
0, 1, 0, -1
}, dr = {
1, 0, -1, 0
};
t.row += dr[t.dir];
t.col += dc[t.dir];
}
/**
* This static method is ok :)
*/
public static void main(String[] args) {
int N = 200;
if( args.length != 0 )
N = Integer.parseInt(args[0]);
// INSTEAD OF A NODE, CREATE SOMETHING MORE USER-FRIENDLY.
Node L = null;
int count = 0;
while( true ) {
// Every N rounds, add another typeA and typeB Thing.
if( count % N == 0 ) {
// Add a typeA thing to the list.
// (GEE, THAT'S A LOT OF CODE FOR JUST CREATING ONE THING)
Thing tA = new Thing();
tA.row = 45;
tA.col = 50;
Node nA = new Node();
nA.data = tA;
nA.next = L;
L = nA;
// Add a typeB thing to the list
Thing tB = new Thing();
tB.row = 55;
tB.col = 50;
tB.lab = 'b';
tB.isTypeB = true;
Node nB = new Node();
nB.data = tB;
nB.next = L;
L = nB;
}
// Print out each thing.
// (SEEMS LIKE A NICE PRINTALL() METHOD CALL WOULD WORK HERE)
// (SEEMS LIKE A toString() METHOD IN THE CLASS WOULD ALSO BE NICE)
for( Node T = L; T != null; T = T.next )
System.out.println(T.data.row + " " + T.data.col + " " + T.data.lab);
System.out.println("done");
System.out.flush();
// Move each thing.
// (SEEMS LIKE A NICE MOVEALL() METHOD CALL WOULD WORK HERE)
for( Node T = L; T != null; T = T.next ) {
maybeTurn(T.data);
step(T.data);
}
count++;
}
}
}
Lab2_Tester.java
import org.junit.Test;
import static org.junit.Assert.assertEqual.
In class, we talked about all sorts of experiments. I would like to s.pdfAroraRajinder1
In class, we talked about all sorts of experiments. I would like to sum them up here. For each of
the following, name and briefly describe an experiment that... (a)...demonstrates that light
behaves like a wave. (b)...demonstrates that light behaves like particles. (c)...demonstrates that
electrons behave like particles. (d)...demonstrates that electrons behave like a wave.
Solution
a) Young\'s Double-Slit Experiment
A definitive experiment was Young\'s double slit experiment, which demonstrated that light
shined at two slits in a screen show an interference pattern characteristic of waves of light, rather
than particles. The principle behind this phenomenon is diffraction of light due to this any point
source of light spreads and behaves like a light source.
In the early 19th century, English scientist Thomas Young carried out the famous double-slit
experiment (also known as Young\'s experiment), which demonstrated that a beam of light, when
split into two beams and then recombined, will show interference effects that can only be
explained by assuming that light is a wavelike disturbance. If light consisted strictly of ordinary
or classical particles, and these particles were fired in a straight line through a slit and allowed to
strike a screen on the other side, we would expect to see a pattern corresponding to the size and
shape of the slit. However, when this single-slit experiment is actually performed, the pattern on
the screen is a diffraction pattern in which the light is spread out. The smaller the slit, the greater
the angle of spread.Similarly, if light consisted strictly of classical particles and we illuminated
two parallel slits, the expected pattern on the screen would simply be the sum of the two single-
slit patterns. In actuality, however, the pattern changes to one with a series of alternating light
and dark bands. When Thomas Young first demonstrated this phenomenon, it indicated that light
consists of waves, as the distribution of brightness can be explained by the alternately additive
and subtractive interference of wavefronts.
b) Photoelectric effect Experiment
When light is shined on clean sodium metal in vacuum then ejection of electrons was observed.
Analysis of data from the photoelectric experiment showed that the energy of the ejected
electrons was proportional to the frequency of the illuminating light. This showed that whatever
was knocking the electrons out had an energy proportional to light frequency. The remarkable
fact that the ejection energy was independent of the total energy of illumination showed that the
interaction must be like that of a particle which gave all of its energy to the electron!
c) and d) Feynman\'s double-slit experiment
In Feynman\'s double-slit thought-experiment, a specific material is randomly directed at a wall
which has two small slits that can be opened and closed at will -- some of the material gets
blocked and some passes through the slits, depending on which ones are open.
Ba.
Jane Lee was employed as a secretary at Burton Trucking. She was fire.pdfAroraRajinder1
Jane Lee was employed as a secretary at Burton Trucking. She was fired when she refused to
perjure herself at a trial where her employer was the defendant. She filed a wrongful discharge
lawsuit against her former employer. Ms. Lee will prevail if the state where the lawsuit was filed
recognizes a public policy exception to the employment-at-will doctrine prevail only if she
proves she was telling the truth will lose because the employment-at-will doctrine completely
insulates the employer from liability will lose because her testimony provided the basis for a
defamation lawsuit by her former employer will prevail under recent amendments to the
Sarbonnes-Oxley Act
Solution.
If a function F) performs the following operations, what knd of cohe.pdfAroraRajinder1
If a function F) performs the following operations, what knd of cohesion does it have?
If it has the optimal cohesion, explain why. If not, correct it.
turn on a LED light;
send a message to a remote computer;
poll a sensor to get a reading;
Solution
Cohesion is the term which refers to the degree by which the various elements inside a function
are related to each other.
In the given list of operations, there is no clear relationship between any of the operations.
Turning on the LED light and sending message to a remote computer can be assumed to be a
form of signalling or notification. However, polling a sensor is clearly an input operation.
Also each of the operations is independent. So, the cohesion in this function is weak.
It can be categorized as the coincidental cohesion. It is the worst kind of cohesion. The
operations are arbitrarily jammed into the same function without any relationship. The only
relationship between them is that all of them are put into the same function.
Therefore, the cohesion is weak. It is coincidental and not optimal.
---------------------------------------------------------------------------------------------------------------------
-
If you have any queries regarding this, please ask in the comments and I will make sure to help
you with it..
How would a subculture appear if a colony containing both S. Marce.pdfAroraRajinder1
How would a subculture appear if a colony containing both S. Marcescens and M. Luteus was
subcultures to a slant?
How would a subculture appear if a colony containing both S. Marcescens and M. Luteus was
subcultures to a slant?
Solution
The slant would show colonies of S marcescens and M luteus as red and yellow respectively.
S marcescens is a gram negative rod shaped organism who has an unique feature of producing a
red colour pigment called prodigiosin at room temperature. Whereas M luteus is a gram positive
coccus shaped organism who produces yellow coloured carotenoid pigments anf grows slowly at
room temperature..
Hint Assume the binary tree is properly balanced (the depth of the .pdfAroraRajinder1
Hint: Assume the binary tree is properly balanced (the depth of the tree T is O(log N)). For full
credit, your algorithm should run in O(K+log N) average time, where K is the number of keys
printed.
Solution
// Since the language is not specified, I\'m doing it in C++.
// Assumption: structure of the tree node:
/*
struct Node{
int data;
Node *left;
Node *right;
};
*/
void method(Node *root, int k1, int k2){
if(root == NULL) return;
method(root->left);
if(root->data >= k1 && root->data <= k2) cout << root->data << \" \";
method(root->right);
}.
essay question Explain how everyday life changes for slaves after e.pdfAroraRajinder1
essay question: Explain how everyday life changes for slaves after emancipation. How did the
agricultural system of labor change in the South? Specifically address why the following issues
were important to freed slaves after the Civil War: marriages, families, names, travel, labor
contracts, and work done by women and children.
Solution
The Emancipation Proclamation and the Union’s victory in the war secured the freedom of
slaves, but with a society plagued by Jim Crow Laws and segregation, ex-slaves were far from
liberated. Slaves paid the price for their freedom as emancipation introduced new hardships,
insecurities, and humiliation.
During the post Civil War and Reconstruction Era, a slave’s fight for freedom turned into a mere
fight for survival. The majority of slaves were released from their previous plantations penniless.
Wages for African Americans also fluctuated in response to the perceived worth of that person
and manual labor was considered easily replaceable during the post Civil War time period. With
income being an issue, few ex-slaves had the ability to own land. According to the 1880 Census,
one-fifith of African Americans owned at least some of the land they farmed. However, these
holdings were usually beset with debt, crippling African American owners in the long run.
Johnson declared that, “Befo’ de war, niggers did have a place to lie down at night and
somewhere to eat, when they got hungry in slavery time.”
This prevalent poverty among ex-slaves during the Reconstruction Era resulted in a lack of
nourishment and medical care which in turn caused a high mortality rate for African Americans,
especially children. Illness left former slaves with the burden of unpaid medical bills or the
inability to access proper medical care. Deficiencies caused African Americans to resort to the
treatment of diseases with herbal and home remedies. The 1900 Census reveals 30 per 1,000
blacks died each year as opposed to only 17 per 1,000 whites.
Death as a result of poverty was not the only thing that affected a slave’s life in the tough times
of the post Civil War era. Ex-slaves were weakened by a severe sense of isolation brought on by
separation from their families. Sales of slaves, the death of owners, and the presentation of slaves
as gifts during the pre- Civil War era were only some of the reasons for this division. Alienation
and loneliness dampened the spirit of these slaves’ new found freedom and made the fight to
survive that much harder.
As whites saw African Americans as an imposition on normality as well as a threat to their
dominance, they continued to make former slaves work for their freedom. Johnson stated in his
narrative that “Since them times, a many a nigger has had it tough to make a livin’. I know dat is
so, too, cause I has been all long dere.” Johnson’s experiences, along with so many others, shed
light on the darker side of emancipation after the Civil War..
Detection versus recognition ... Investigate Face++ at Feel free to.pdfAroraRajinder1
Detection versus recognition ... Investigate Face++ at Feel free to browse to other similar sites
Explain the difference between face detection and face recognition. Give an example use of each
in IT.
Solution
solution:
Face detection is a program that determines the locations of human faces in a digital image.
Face recognition is a program that identifies a person in a digital image.
There are several notions that should be distinguished.
Classification = partition of a set of observable objects into disjoint similarity classes (maybe,
constituting a hierarchical structure).
Detection = in a large set of objects finding out all those belonging to a certain similarity class.
Recognition = for a given object answering, to what of (a priori defined) similarity classes it
belongs. Identification = a particular case of recognition: proving that a given object really
belongs to a similarity class being declared.
Face detection aims at the detection/location of face in an image while Face recognition aims at
identifying the face with some known faces.
The best example for face detection is our Digital Cameras, you see a square over the faces,
when taking photos. Face recognition is usually used in forensics to identify fugitives from street
cameras... or something like that.
face detection is an attempt to detect faces in an image (or video, I guess). Face detection
software will typically provide the location and face size/orientation of each region of the image
it feels is probably a face. In my experience, the results can be quite noisy. Depending on how
the detection parameters are set, you may get many non-faces and will likely miss some/many
faces (especially if they are partially obscured).
Face recognition, on the other hand, attempts to identify a face in an image that is known (or
thought to) contain a single face. Face detection may be applied first to extract image segments
containing faces. A database of face data for individuals is needed, and the face recognition
software will attempt to associate the provided image with one or more records in the database,
typically with a probability that the faces match.
Eigenfaces & Fisherfaces
Those familiar with linear algebra will remember that every vector space has an orthogonal
basis. By combining elements of this basis we can compose every vector in this vector space.
And vice versa, every vector in the vector space can be decomposed to the elements of the basis.
Images (grayscale) are nothing more than a series of numbers, each number corresponding to
some intensity level. So why not treat images as vectors? Say, for example, we have a collection
of face images of size 150 by 150 pixels; each of these images can be thought of as a vector of
size 22,500 (150*150). We can now talk about the vector space in which these vectors reside. By
treating the images as samples of data, we can perform a Principal Components Analysis and
obtain the eigenvectors which make up the basis of the vector spa.
Dent disease is a rare disorder of the kidney in which reabsorption o.pdfAroraRajinder1
Dent disease is a rare disorder of the kidney in which reabsorption of filtered solutes is impaired
and there is progressive renal failure. R. R. Hoopes and colleagues studied mutations associated
with Dent disease in the following family (R. R. Hoopes et al. American Journal of Human
Genetics 76:260-267, 2005). On the basis of this pedigree, what is the MOST likely mode of
inheritance for the disease? Autosomal recessive X-linked recessive Autosomal dominant X-
linked dominant Y-linked.
Solution
On the basis of pattern of inheritance of particuar traint, The answer is Autosomal recesseve..
DEFINE: maternal determinant (3-4 sentences).
Solution
Maternal determinants are some types of molecules which are maternally supplied to the oocyte,
the cell which produce fully grown organism, and the molecules regulate various processes by
which the fate and developmental pattern of the oocyte is decided. Maternal transcription factors,
Maternal signaling molecules, Maternal signaling pathway regulators are types of the
biomolecules known as maternal determinants. Mitochondria, Nucleolus, and some Ribosomes
also have maternal origin. VegT ( mRNA), Vg1 (mRNA), p53 (Protein), CREB (Protein), FGF2
(mRNA), Ectodermin (Protein), fatvg (mRNA) are some important maternal determinants..
Consider a partial function.For every unmapped element in its doma.pdfAroraRajinder1
Consider a partial function.
For every unmapped element in its domain, map that element to \"infinity\". Does this
modification make the partial function into a function? Why or why not?
Solution
It doesn\'t because \"infinity\" is not a real number. So, in any case there is no output for the
specified unmapped elements..
Compare and Contrast hollow core fibers for high power delivery an.pdfAroraRajinder1
Compare and Contrast hollow core fibers for high power delivery and negative curvature hollow
core fibers. Essay answers are limited to about 1000 words (3800 characters maximum,
including double spaces).
Compare and Contrast hollow core fibers for high power delivery and negative curvature hollow
core fibers. Essay answers are limited to about 1000 words (3800 characters maximum,
including double spaces).
Solution
NC-HCF:-NEGATIVE curvature hollow core optical fiber (NC-HCF) is a novel hollow core
optical fiber (HCF) which has emerged over the last few years. NC-HCF is characterized by the
inverted curvature of its core wall, and usually exhibits multiple spectral transmission bands of
low attenuation. The simple structure of the fiber cladding allows flexible tailoring of NC-HCFs
design and dimension for specific wavelengths and applications. Since their first appearance NC-
HCFs have been applied in high power/ultrafast laser delivery and several other applications.
This paper comprises eight sections:It consists of a brief history of NC-HCF, while the optics of
NC-HCF will be discussed. From the guidance properties of NC-HCFs are collated and
summarized including mode attenuation, bending loss, dispersion and nonlinearity. reviews some
applications of NC-HCFs and contains conclusions.
Hollow core negative curvature fibre (HC-NCF):Hollow core negative curvature fibre (HC-NCF)
is another kind of leaky HCF, which features negative curvature of the core boundary The
importance of curvature of the core boundary in HCF was firstly discovered in Kagome fibres by
Wang et al. in 2010. A Kagome fibre with negative curvature of the core boundary exhibited an
unexpected lower attenuation than regular ones. A series of subsequent experiments confirmed
the function of the negative curvature core wall in the reduction of attenuation in Kagome fibres.
Later in 2010 Gérôme et al. demonstrated that the complex structure of the cladding has a
negligible effect on the confinement loss of Kagome fibre. At the same time, Vincetti and Setti
numerically studied HC-NCF with a simplified cladding systematically and revealed that the
coupling interaction between the core mode and cladding mode decides the high loss
transmission spectral regions of HC-NCF. In 2011, Pryamikov et al. fabricated the first silica
HC-NCF without lattice structure in the cladding. They demonstrated that light can be
transmitted through a 63 cm length of silica fibre at 3 m wavelength even though. The fused
silica exhibits very high material absorption in this spectral region. Afterwards, Kosolapov et al.
extended the transmission window in a similar structured HC-NCF to 10.6 m for CO2 laser by
using chalcogenide glass instead of silica as the fabrication material. In 2012 during the course of
this thesis I designed, fabricated and characterised a silica HC-NCF with low loss transmission in
the mid-infrared spectral region from 3 µm to 4 µm, with minimum attenuation of 34 dB/km at a
wavele.
Can we create an object of type Interface Explain your answer.So.pdfAroraRajinder1
Can we create an object of type Interface? Explain your answer.
Solution
The answer is w.r.t JAVA
You can\'t instantiate an interface directly, but you can instantiate a class that implements that
interface:
This is basically the same as what you\'re doing inline. The brackets after new Runnable() will
contain your implementation inline..
Cancel QuestionSolutionSince Descriptive statistics uses the d.pdfAroraRajinder1
Cancel Question
Solution
Since Descriptive statistics uses the data to provide descriptions of the population, either through
numerical calculations or graphs or tables. Inferential statistics makes inferences and predictions
about a population based on a sample of data taken from the population in question.
So a) Is Descriptive
b) is Descriptive
c) is Inferential
d) is Inferential
e) is Descriptive
f) is Descriptive.
According to the cladogram, what derived trait is shared by primates .pdfAroraRajinder1
According to the cladogram, what derived trait is shared by primates and rodents/rabbits? What
is the correct term for the area labeled with a circle? What does it represent? What is the correct
term for the earliest branch pictured in the cladogram (the one with the shark)? What does it
represent?
Solution
PART1)According to the cladogram,hair trait is shared by primates and rodden rabbis.........
PART2)IT represents they are reptiles....
PART3)IT represents it is the oldest organism...........
A male Flagus fly with the Barkus phenotype is crossed with a female.pdfAroraRajinder1
A male Flagus fly with the Barkus phenotype is crossed with a female who has the wild-type
phenotype. A second cross is performed in which the female Flagus fly has the Barkus
phenotype and the male has the wild-type phenotype. This second cross is known as a:
A. inter-cross.
B. recessive cross.
C. motor-cross.
D. dominant cross.
E. reciprocal cross.
Solution
E. Reciprocal Cross.
2015Matthew and Michael Goode (cousins) decide to form a partners.pdfAroraRajinder1
2015:
Matthew and Michael Goode (cousins) decide to form a partnership (M&M) on April 1, 2015.
Each contributed personally-owned assets to start the new company. Matthew Goode contributed
$100,250 in cash and property with book value of $57,750 and appraised value of $78,750.
Michael Goode contributed cash of $99,750; computer equipment with book value of $52,500
and appraised value of $21,000; a software library with book value of $63,000 and appraised
value of $23,500; and office equipment with book value of $57,750 and appraised value of
$26,250. M&M operates on a calendar year.
The Articles of Partnership stipulate that no goodwill is to be recognized and that the two will
start with capital balances equal to their contributions. Monthly cash draws of $1,350 each are
allowed, beginning June 1, 2015. Net income is to be allocated as follows:
(a)Matthew is to receive a compensation allowance of $2,625 per month for managing the day-
to-day operations of the partnership.
(b)Interest of 12.25% to be paid on ending balances of capital accounts, PLUS 15% interest on
ending capital balances in excess of $262,500 (all interest to be calculated without current
income allocation).
(c)Each partner is to receive a bonus equal to 15% of net income, after the compensation
allowance, interest, and bonuses. Negative bonuses are not allowed.
(d)Remainder of profit to be allocated in a 55:45 ratio, Matthew:Michael.
(e)Remainder of loss to be allocated in a 50:50 ratio.
Net partnership income for 2015 was $210,000.
2016:
June 1, 2016, Maxwell Goode (Matthew’s twin brother) joins the partnership (ThreeM). He
purchases 1/3 of Matthew’s ownership interest for cash of $78,750 and 1/4 of Michael’s
ownership interest for cash of $63,000, paid directly to the partners.
The Articles of Partnership are amended as follows for allocation of net income:
(a)In addition to Matthew’s compensation allowance, Michael will receive a compensation
allowance of $1,575 per month, and Maxwell $1,260 per month.
(b)Unchanged.
(c)Matthew, Michael, and Maxwell are to receive bonuses of 12.5%, 12.5% and 10%,
respectively, of net income after the compensation allowances, interest, and bonuses. Negative
bonuses are not allowed.
(d)Remainder of profit to be allocated in a 40:35:25 ratio, Matthew:Michael:Maxwell.
(e)Remainder of loss to be allocated equally among the three partners.
Net partnership income for 2016 was $262,500.
2017:
Morgan (Michael’s younger brother) is admitted to the partnership (MM MM Goode) on January
2, 2017. He purchases a 32% interest for a cash payment of $260,000, paid directly to the
partnership.
The Articles of Partnership are amended as follows for allocation of net income:
(a)Partners will receive the following compensation allowances per month: Matthew, $3,150;
Michael, $2,625; Maxwell, $2.200; and Morgan, $2,000.
(b)Unchanged.
(c)Matthew, Michael, Maxwell, and Morgan are to receive bonuses of 12%, 12%, 10%, and
10%, respectively, of net income after the co.
1. Jose is a Latino client who presents with occupational difficulti.pdfAroraRajinder1
1. Jose is a Latino client who presents with occupational difficulties. He was laid off from a
construction job 8 months ago and has been unable to find work. Ever since he lost his job, he
has been drinking alcohol heavily throughout the day. He also reports “occasional” marijuana
use. Jose recently was arrested for driving under the influence of alcohol and has to appear in
court next month. His wife is angry with him because she depends on him to pick up their 3
children from school, and now he may lose his driver’s license. Jose has always been a hard
worker, but he admits that there were times that he often drank alcohol while working on
construction jobs to eliminate his stress. He reports having intermittent episodes of anxiety since
adolescence. Based on the information provided, Jose’s principal diagnosis would likely be: A.
Alcohol use disorder B. Cannabis use disorder C. Adjustment disorder with mixed anxiety and
depressed mood D. Major depressive anxiety disorder
Solution
A. Alcohol use disorder
Heavy drinking leads to \"alcohol use disorder.\" It is characterized by increased tendency to
drink alcohol, inability to quit alcohol, neglecting the family responsibilities due to heavy
drinking, anxiety, depression and alcohol withdrawal symptoms such as difficulty in sleeping,
seizures, high blood pressure, etc..
You have a small business customer who wants to use a voice over IP .pdfAroraRajinder1
You have a small business customer who wants to use a voice over IP (VoIP) system and
subscribe to this service through his ISP using DSL. What special piece of equipment will need
to be installed to provide analog-to-digital signal conversion between the phones and the digital
network?
A. A cable modem
B. A DSL modem
C. An Integrated access device (IAD)
D. A multimedia terminal adapter (MTA)
Solution
a cable modem is anetwork bridge and modem connects bi-directional data communication radio
frequncy channel on a hybrid fibar co axial and radio frequncy over glass infra structure.
A digital subscriber line (DSL) modem is a device used to connect a computer or router to a
telephone line which provides the digital subscriber line service for connectivity to the Internet.
An Integrated Access Device (or IAD) is a customer premises device that provides access to
wide area networks and the Internet.
A multimedia terminal adapter (MTA), or Home Phone modem, operates much the same as a
cable modem, but an MTA can deliver Home Phone service in addition to High Speed Internet.
so answer is B. A DSL Modem.
Why can some microbial species grow and survive in extreme environ.pdfAroraRajinder1
Why can some microbial species grow and survive in extreme environments?
Why can some microbial species grow and survive in extreme environments?
Solution
Microbial species grow and survive in extreme environments. These organisms are the
extremophiles. There are different types of extremophiles:
-Thermophiles and hyperthermophiles (organisms growing at high or very excessive
temperatures, respectively)
-psychrophiles (organisms that develop best at low temperatures)
-acidophiles and alkaliphiles (organisms optimally tailored to acidic or fundamental pH values,
respectively)
-barophiles (organisms that develop quality underneath pressure)
-halophiles (organisms that require NaCl for increase).
The different types of extremophiles have exceptional adaptations that allow them to thrive
mainly extremes.
1.Life at High Temperatures. Thermophiles have molecules and cell membranes that preserve
their stability at excessive temperatures. As all cellular additives need to be made heat stable and
their evolutionary function is derived of all recognized lifestyles.
2.Life at Low Temperatures and Extreme pH Levels. The molecules and membranes of
psychrophiles are designed to maximise flexibility. Extremophiles that grow exceptional at pH
extremes maintain a neutral pH inside their cells.
3.Life in a Brine and Other Environments. Halophiles ought to keep a balance between the
solute concentration in their cells and their salty surroundings. Halophiles are able to live in salty
conditions by preventing dehydration of their cytoplasm.a
Radiation-resistant micro organisms adaptedto literally shatter its chromosome into hundreds of
pieces. Some extreme barophiles grow optimally at pressures over 500 atmospheres. The
transmembrane proteins in barophiles likely are modified to still function at high pressures..
Which prokaryotic group maps most closely to the chlorophyll of plan.pdfAroraRajinder1
Which prokaryotic group maps most closely to the chlorophyll of plants on the phylogenetic
tree? cyanobacteria planctomyces proteobacteria spirochetes
Solution
cyanobacteria maps most close to chlorophyll of plants as cyanobacteria contains chlorophyll
and psycobillins though chlorophyllin them is a little different from that of eukaryotes ..... hope it
helps.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Keep getting a null pointer exception for some odd reasonim creati.pdf
1. Keep getting a null pointer exception for some odd reason
im creating the variable and the object but it still isnt working
My code is below please help
package classes;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.*;
import java.util.*;
import java.text.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class NewClass4
{
private class Node
{
private String text;
private int Hit;
private int Miss;
private Node next;
public Node(String text, int Hit, int Miss, Node next)
{
this.text=text;
this.Hit=Hit;
this.Miss=Miss;
this.next=next;
}
public void incrementHit()
{
this.Hit = this.Hit+1;
}
public void incrementMiss()
2. {
this.Miss = this.Miss+1;
}
public String getText()
{
return this.text;
}
public int getHit()
{
return this.Hit;
}
public int getMiss()
{
return this.Miss;
}
}//end of node
private class LL
{
public Node head;
public LL()
{
head=null;
}
public void insert(String text2, boolean isHit)
{
System.out.println("entered insert method");
Node temp=this.head;
System.out.println("sent temp node to head");
while((temp!=null) && (!temp.text.equals(text2)) )
{
temp=temp.next;
}
if(temp==null)
{
// we did not find the string
if(isHit)
3. {
this.head=new Node(text2,1, 0, this.head );
}
else
{
this.head=new Node(text2,0, 1, this.head );
}
}
else
{
if(isHit)
{
temp.incrementHit();
}
else
{
temp.incrementMiss();
}
}
}//end of insert
public void printList()
{
Node temp=this.head;
while(temp!=null)
{
int Hit=temp.getHit();
int Miss=temp.getMiss();
double sucRate=Hit*100/(Hit+Miss);
System.out.println(temp.getText() + " " + sucRate);
}
}
}// end of LL
private static LL myLL;
public NewClass4()
4. {
this.myLL = new LL();
}
public static void main(String[] args)
{
SimpleDateFormat sdf = new
SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss",Locale.ENGLISH);
String myString = null;
Pattern a = Pattern.compile("[0-9]{2}/?[A-Za-z]{3,4}/?[0-9]{4}[.,-:]{1}[0-9.,-
:]{1,}s+");
Pattern d= Pattern.compile("s+/+[0-9.]{3}/+[A-Za-z]{1,}/+[A-Za-z.,-:%]{1,}");
Pattern f= Pattern.compile("s+[0-9]{3}s+");
String newLine;
try {
File file = new File("myFile.txt");
FileReader fileReader = new FileReader(file);
BufferedReader bufferedReader = new BufferedReader(fileReader);
String line;
while ((line = bufferedReader.readLine()) != null)
{
myString = line;
System.out.println(myString);
Matcher m1 = a.matcher(myString);
Matcher m2 = d.matcher(myString);
Matcher m3 = f.matcher(myString);
if (m1.find() && m2.find()&& m3.find())
try {
Date parsedDate = sdf.parse(m1.group());
SimpleDateFormat print = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
int responseCode = Integer.parseInt(m3.group().trim());
System.out.println(print.format(parsedDate)+ " "+m2.group()+" "+responseCode);
newLine = print.format(parsedDate)+ " "+m2.group();
// decide true or false
if (responseCode >= 500 )
{
5. if (NewClass4.myLL == null)
{
System.out.println("Link List is empty");
}
NewClass4.myLL.insert(newLine, false);
}
else
{
NewClass4.myLL.insert(newLine, true);
}
} // end of second try
catch (ParseException e)
{
e.printStackTrace();
}
}// end of while
fileReader.close();
//System.out.println("Contents of file:");
}//end of first try
catch (IOException e)
{
e.printStackTrace();
}
//Classes.myLL.printList();
}// end of main
}// end of Classes
Solution
package classes;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
6. import java.io.*;
import java.util.*;
import java.text.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class NewClass4 {
private class Node {
private String text;
private int Hit;
private int Miss;
private Node next;
public Node(String text, int Hit, int Miss, Node next) {
this.text = text;
this.Hit = Hit;
this.Miss = Miss;
this.next = next;
}
public void incrementHit() {
this.Hit = this.Hit + 1;
}
public void incrementMiss() {
this.Miss = this.Miss + 1;
}
public String getText() {
return this.text;
}
public int getHit() {
return this.Hit;
}
public int getMiss() {
return this.Miss;
}
}// end of node
private class LL {
public Node head;
public LL() {
7. head = null;
}
public void insert(String text2, boolean isHit) {
System.out.println("entered insert method");
Node temp = this.head;
System.out.println("sent temp node to head");
while ((temp != null) && (!temp.text.equals(text2))) {
temp = temp.next;
}
if (temp == null) {
// we did not find the string
if (isHit) {
this.head = new Node(text2, 1, 0, this.head);
} else {
this.head = new Node(text2, 0, 1, this.head);
}
} else {
if (isHit) {
temp.incrementHit();
} else {
temp.incrementMiss();
}
}
}// end of insert
public void printList() {
Node temp = this.head;
while (temp != null) {
int Hit = temp.getHit();
int Miss = temp.getMiss();
double sucRate = Hit * 100 / (Hit + Miss);
System.out.println(temp.getText() + " " + sucRate);
}
}
}// end of LL
private static LL myLL;
public NewClass4() {
8. this.myLL = new LL();
}
public static void main(String[] args) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss",
Locale.ENGLISH);
String myString = null;
Pattern a = Pattern
.compile("[0-9]{2}/?[A-Za-z]{3,4}/?[0-9]{4}[.,-:]{1}[0-9.,-:]{1,}s+");
Pattern d = Pattern
.compile("s+/+[0-9.]{3}/+[A-Za-z]{1,}/+[A-Za-z.,-:%]{1,}");
Pattern f = Pattern.compile("s+[0-9]{3}s+");
String newLine;
try {
File file = new File("myFile.txt");
FileReader fileReader = new FileReader(file);
BufferedReader bufferedReader = new BufferedReader(fileReader);
String line;
while ((line = bufferedReader.readLine()) != null) {
myString = line;
System.out.println(myString);
Matcher m1 = a.matcher(myString);
Matcher m2 = d.matcher(myString);
Matcher m3 = f.matcher(myString);
if (m1.find() && m2.find() && m3.find())
try {
Date parsedDate = sdf.parse(m1.group());
SimpleDateFormat print = new SimpleDateFormat(
"yyyy-MM-dd'T'HH:mm");
int responseCode = Integer.parseInt(m3.group().trim());
System.out.println(print.format(parsedDate) + " "
+ m2.group() + " " + responseCode);
newLine = print.format(parsedDate) + " " + m2.group();
// decide true or false
if (responseCode >= 500) {
if (NewClass4.myLL == null) {
System.out.println("Link List is empty");
9. }
NewClass4.myLL.insert(newLine, false);
} else {
NewClass4.myLL.insert(newLine, true);
}
} // end of second try
catch (ParseException e) {
e.printStackTrace();
}
}// end of while
fileReader.close();
// System.out.println("Contents of file:");
}// end of first try
catch (IOException e) {
e.printStackTrace();
}
// Classes.myLL.printList();
}// end of main
}// end of Classes
myFile.txt
2011-06-14T04:12
2013-06-14T04:12
2012-06-14T04:12
Note: Please make sure the path of the file is in the project location, i think that is the problem