In: Finance
1. Consider Consumers A, B, and C with the following preferences over two goods.
UA (x1,x2) = x12x23
UB (x1,x2) = 2x1+3x2
UC (x1,x2) = min{2x1,3x2)
The prices given are p1, p2 and income for each consumer is m.
Solve for the Engel curves for each consumer.
please be very detailed, thank you!
In: Economics
Hello,
How can I make the program print out "Invalid data!!" if the file has a grade that is not an A, B, C, D, E, or F or a percentage below zero.
The program should sort a file containing data about students like this for five columns: one for last name, one for first name, one for student ID, one for student grade percentage, one for student grade.
Smith Kelly 438975 98.6 A
Johnson Gus 210498 72.4 C
Reges Stu 098736 88.2 B
Smith Marty 346282 84.1 B
Reges Abe 298575 78.3 C
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Here is the program.
DRIVER CLASS:
package pkg13_3;
import java.util.*;
import java.io.*;
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws
FileNotFoundException,
InputMismatchException{
try
{
Scanner scan = new Scanner(new File("files.txt"));
ArrayList <Student> elements = new
ArrayList<Student>();
while(scan.hasNext())
{
String last = scan.next();
String first = scan.next();
int idNum = scan.nextInt();
double perecent = scan.nextDouble();
String grade = scan.next();
elements.add(new Student(last, first, idNum, perecent,
grade));
}
Student[]element = new Student[elements.size()];
for(int i = 0; i<element.length;i++)
{
element[i] = elements.get(i);
}
System.out.println("Student data by last name: ");
Arrays.sort(element, new LastNameComparator());
for(int i = 0; i<element.length; i++)
{
System.out.println(element[i].toString());
}
System.out.println("Student data by first name: ");
Arrays.sort(element, new FirstNameComparator());
for(int i = 0; i<element.length; i++)
{
System.out.println(element[i].toString());
}
System.out.println("Student data by student id: ");
Arrays.sort(element, new IDComparator());
for(int i = 0; i<element.length; i++)
{
System.out.println(element[i].toString());
}
System.out.println("Student data by percentage: ");
Arrays.sort(element, new PercentageComparator());
for(int i = 0; i<element.length; i++)
{
System.out.println(element[i].toString());
}
System.out.println("Student data by percentage: ");
for(int i = 0; i<element.length; i++)
{
System.out.println(element[i].toString());
}
System.out.println("Student data by grade: ");
Arrays.sort(element, new GradeComparator());
for(int i = 0; i<element.length; i++)
{
System.out.println(element[(element.length - 1)
-i].toString());
}
break;
}
catch(FileNotFoundException e)
{
System.out.println(e.toString());
}
catch(InputMismatchException f)
{
System.out.println(f.toString());
}
}
}
STUDENT CLASS:
package pkg13_3;
/*
* 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.
*/
/**
*
* @author user
*/
public class Student {
String firstName, lastName;
int idNum;
double percent;
String grade;
public Student(String myFirstName, String myLastName, int id,
double pct,
String myGrade)
{
lastName = myFirstName;
firstName = myLastName;
idNum = id;
percent = pct;
grade = myGrade;
}
public String getLastName()
{
return lastName;
}
public String getFirstName()
{
return firstName;
}
public int getID()
{
return idNum;
}
public double getPercentage()
{
return percent;
}
public String getGrade()
{
return grade;
}
public String toString()
{
return lastName + "\t" + firstName + "\t" + idNum + "\t" +
percent + "\t" + grade;
}
}
-------------------------------------------------------------------------------------
LastNameComparator:
/*
* 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.
*/
package pkg13_3;
import java.util.*;
/**
*
* @author user
*/
public class LastNameComparator implements Comparator<
Student>{
public int compare(Student student1, Student student2)
{
return
student1.getLastName().compareTo(student2.getLastName());
}
}
-----------------------------------------------------------------------------------------------------------
First name comparator
--------------------------------------------------------------------------------------------------------------
package pkg13_3;
import java.util.*;
/**
*
* @author user
*/
public class FirstNameComparator implements Comparator<
Student>{
public int compare(Student student1, Student student2)
{
return
student1.getFirstName().compareTo(student2.getFirstName());
}
}
---------------------------------------------------------------------------------------------------------------
/*
* 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.
*/
package pkg13_3;
import java.util.*;
/**
*
* @author user
*/
public class IDComparator implements Comparator<
Student>{
public int compare(Student student1, Student student2)
{
return student1.getID() - (student2.getID());
}
}
-------------------------------------------------------------------------------------------------
Percentage Comparator
_____________________________________________________________
package pkg13_3;
import java.util.*;
/**
*
* @author user
*/
public class PercentageComparator implements Comparator<
Student>{
public int compare(Student student1, Student student2)
{
return (int)(student1.getPercentage() -
(student2.getPercentage()));
}
}
------------------------------------------------------------------------------------------------------
Grade Comparator:
package pkg13_3;
import java.util.*;
/**
*
* @author user
*/
public class GradeComparator implements Comparator<
Student>{
public int compare(Student student1, Student student2)
{
return student1.getGrade().compareTo(student2.getGrade());
}
}
_____________________________________________________________
Thank you
In: Computer Science
Puzzle #4
Five friends each wrote a letter to Santa Claus, pleading for certain presents. What is the full
name of each letter-writer and how many presents did he or she ask for? Kids’ names: Danny,
Joelle, Leslie, Sylvia, and Yvonne. Last names: Croft, Dean, Mason, Palmer, and Willis. Number
of presents requested: 5, 6, 8, 9, and 10.
Clues:
1. Danny asked for one fewer present that the number on Yvonne’s list.
2. The child surnamed Dean asked for one more present than the number on the list written by
the child surnamed Palmer.
3. Sylvia’s list featured the fewest presents, and the letter written by the child surnamed Willis
featured the highest quantity.
4. Joelle asked for one fewer present than the number specified in the Croft child’s letter.
Make your grid to solve:
In: Statistics and Probability
In C++
A new author is in the process of negotiating a contract for a new romance novel. The publisher is offering three options.
The author has some idea about the number of copies that will be sold and would like to have an estimate of the royalties generated under each option.
Instructions
Write a program that prompts the author to enter:
The program then outputs:
(Use appropriate named constants to store the special values such as royalty rates and fixed royalties.)
Since your program handles currency, make sure to use a data type that can store decimals with a decimal precision of 2.
Example input:
120 22.99
Expected Output:
25000.0
344.8
275.8
Option 1 is the best
In: Computer Science
(C++) Redo Programming Exercise 16 of Chapter 4 so that all the named constants are defined in a namespace royaltyRates. Instructions for Programming Exercise 16 of Chapter 4 have been posted below for your convenience. Exercise 16 A new author is in the process of negotiating a contract for a new romance novel.
The publisher is offering three options. In the first option, the author is paid $5,000 upon delivery of the final manuscript and $20,000 when the novel is published. In the second option, the author is paid 12.5% of the net price of the novel for each copy of the novel sold. In the third option, the author is paid 10% of the net price for the first 4,000 copies sold, and 14% of the net price for the copies sold over 4,000. The author has some idea about the number of copies that will be sold and would like to have an estimate of the royalties generated under each option. Write a program that prompts the author to enter the net price of each copy of the novel and the estimated number of copies that will be sold. The program then outputs the royalties under each option and the best option the author could choose. (Use appropriate named constants to store the special values such as royalty rates and fixed royalties.)
An input of: 20, 5
Should have an output of:
In: Computer Science
In this experiment, the motion of a fan cart with a mass of 480g was measured as it accelerated from rest, along a horizontal track. These results were calculated from data collected by LoggerPRO.
Trial 1 Trial 2 Trial 3
Acceleration from x-t graph (m/s2) 0.642 0.622 0.651
Acceleration from v-t graph (m/s2) 0.618 0.664 0.604
A new experiment will be run, with these changes:
Will the fan cause the same cart to accelerate up the incline, down the incline, or will the cart remain at rest? Show your calculations, and explain fully in words.
In: Physics
In: Economics
• Define each type of variable: dichotomous, ordinal, categorical, continuous • Define the following study designs: Randomized controlled trial, prospective cohort study, case-control study, crossover study. • Define in dependent versus independent samples.
In: Math
In SUMMER 2018 session, Sonia Buchanan, took four final exams. The exam mean and standarddeviation for each course (class) along with Sonia’s score on each exam are listed in table below.Assume that the grades on each exam are NORMALLY DISTRIBUTED.
|
Exam |
Mean for cohort (class) |
Standard deviation for cohort (class) |
Daniel’s score |
|
Introduction to Sociology Life and Teachings of Christ Principles of Psychology Freshman Composition II |
75 85.6 83 70.4 |
4.2 6.7 4.9 6.4 |
79 91 88 76 |
Discuss the importance of the normal distribution curve in the Behavioural Sciences
With respect to the normal curve what is a percentile rank? Give an example using a diagram
Calculate Sonia's percentile rank for the Life and Teachings of Christ
On which exam did Sonia do best relative to the other students in the class
In: Statistics and Probability