Questions
1. Create an xml documents called company.xmlcontaining two sections employees and invoices with the following specifications:...


1. Create an xml documents called company.xmlcontaining two sections employees and invoices with the following specifications:

A.

Employee
Name
o Last name
o First name
Address
Hire Date

B.

Invoice
Order (Should have an order number attribute)
o Name (of the customer)
o Address (of the customer)
o Total price (of the order)
o Date (of the order)
Shipping info
o Name (of the company) - Use either of the following:
Fed Ex
UPS
o Total price (for shipping)
o Date (Ship date)
Description
o (This section should describe the ordered product. Use <product> whenever the product is mentioned.)

Assume that in the first section (employees) you have chosen tags name, address, date to define the elements employee name, employee address and hire date correspondingly, while in the second section (invoices) you have chosen tags name, address, date to define the elements name of the customer, address of the customer, and date of the ordercorrespondingly. When you create your xml file make sure that one set of tags will not conflict with another (see namespaces in my notes). For example, under the above assumption employees and invoices sectionswill have tags called name, address, date each referring to different types of data depending on the context (e.g. employee name and address vs customer name and address , etc. ). Make sure the documents is well-formed and that your element names follow the specified naming convention in my notes.   

Hint. Use namespaces to resolve naming conflicts.

What to turn in: Submit via Canvas an xml file satisfying the specifications of this lab. The grading will reflect thecorrectness of your markup. Check your XML documentwith your browser before turning it in.

In: Computer Science

PYTHON Modify the program in section Ask the user for a first name and a last...

PYTHON

Modify the program in section

Ask the user for a first name and a last name of several people.

 Use a loop to ask for user input of each person’s first and last names

 Each time through the loop, use a dictionary to store the first and last names of that person

 Add that dictionary to a list to create a master list of the names

 Example dictionary:

aDict = { "fname":"Douglas", "name":"Lee" }

 Example master list, each element in the list is a dictionary:

namesList = [

{ "fname":"Douglas", "lname":"Lee" },

{ "fname":"Neil", "lname": "Armstrong" },

{ "fname":"Buzz", "lname":"Aldrin" },

{ "fname":"Eugene", "lname":"Cernan"},

{ "fname":"Harrison", "lname": "Schmitt"}

]

Pseudocode:

1) Ask for first name

2) Ask for last name

3) Create a dictionary with first name and last name

4) Add that dictionary to the master list object

5) If more names, go to (1)

6) If no more names, print the master list in a visually pleasing manner

In: Computer Science

Write a pseudocode for the following code: /*every item has a name and a cost */...

Write a pseudocode for the following code:

/*every item has a name and a cost */
public class Item {

   private String name;
   private double cost;
   public Item(String name, double cost) {
       this.name = name;
       this.cost = cost;
   }
   public String getName() {
       return name;
   }
   public void setName(String name) {
       this.name = name;
   }
   public double getCost() {
       return cost;
   }
   public void setCost(double cost) {
       this.cost = cost;
   }   
}

public enum PaymentType {
   CASH,
   DEBIT_CARD,
   CREDIT_CARD,
   CHECK
}

/*every payment has a type and an amount*/

public class Payment {
   private double amount;
   private PaymentType paymentType;
   public Payment(double amount, PaymentType paymentType) {
       this.amount = amount;
       this.paymentType = paymentType;
   }
   public double getAmount() {
       return amount;
   }
   public void setAmount(double amount) {
       this.amount = amount;
   }
   public PaymentType getPaymentType() {
       return paymentType;
   }
   public void setPaymentType(PaymentType paymentType) {
       this.paymentType = paymentType;
   }   

In: Computer Science

I am working on making a simple gradebook. How it works is it asks user for...

I am working on making a simple gradebook. How it works is it asks user for name and grade. It does this for multiple instances until the person types quit to end the program. The code I have here works. My question is how do I print the output in alphabetical order?

Output from the input I put into my program:

David 98

Annabelle 87

Josh 91

Ben 95

What I want my code to do (in alphabetical order):

Annabelle87

Ben 95

David 98

Josh 91

Here is my code for the program:

grades = {}


def set_grade(name, grade):
grades[name] = grade


def print_grades_names():
for i in grades.keys():
print('{} {}'.format(i, str(grades[i])))

while True:
name = input("Enter a name (or 'quit' to stop): ")
if name == 'quit':
break
grade = input("Enter a grade: ")
set_grade(name, grade)


(print_grades_names())

In: Computer Science

I'm trying to ask a series of questions with validation in python. example: What is your...

I'm trying to ask a series of questions with validation in python.

example:

What is your name? (if valid name then continue to question 2)

What is your email? (if not valid then ask this question again, if valid then next question)

How old are you? (again, if invalid then ask again, if valid then next.

import re

def get_new_artwork():

    name_regex = "^(?=.{2,40}$)[a-zA-Z]+(?:[-'\s][a-zA-Z]+)*$"

    email_regex = '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$'

    while True:

        name = input('Enter your name: ').title().strip()

        if re.search(name_regex, name) is None:

            print('Invalid name. ')

        else:

            email = input('Enter your email: ')

            if re.search(email_regex, email) is None:

                print('Invalid email. ')

            else:

                age = int(input('How old are you? '))

                if age >=17:

                    print('Too young. ')

                else:                  

                    print('user added. ')

                    break

    return (name, email, age)     

get_new_artwork()

In: Computer Science

Assignment Requirements Write a python application that consists of two .py files. One file is a...

Assignment Requirements

Write a python application that consists of two .py files. One file is a module that contains functions used by the main program. NOTE: Please name your module file: asgn4_module.py

The first function that is defined in the module is named is_field_blank and it receives a string and checks to see whether or not it is blank. If so, it returns True, if not it return false.

The second function that is defined in the module is named is_field_a_number and it receives a string and checks to see whether or not it is a number. If so, it returns True, if not it return false.

The other .py file should properly call a main function that does the following...

1. Prompts the user to enter their first name.

Call the is_field_blank function to see if nothing was entered.
If nothing was entered it displays the following message...

"First Name must be Entered"

...and re-prompts the user to enter the first name. It does this repeatedly until the user enters a first name.


2. Prompts the user to enter their last name.

Call the is_field_blank function to see if nothing was entered.
If nothing was entered it displays the following message...

"Last Name must be Entered"

...and re-prompts the user to enter the last name. It does this repeatedly until the user enters a last name.

3. Prompts the user to enter their age.

Call the is_field_blank function to see if nothing was entered. If nothing was entered it displays the following message...

"Age must be Entered"

...and re-prompts the user to enter their age. It does this repeatedly until the user enters a age.

Once the user has entered a non-blank age call the is_field_a_number function to see if the age entered is a number. If not, display the following message...

"Age must be a Number"


...and re-prompt the user to enter their age. It does this repeatedly until the user enters a numeric age.


4. If the user's age is over 40 display a message in the following format:

Well, (first name) (last name) it looks like you are over the hill


Otherwise display a message in the following format:

It looks like you have many programming years ahead of you (first name) (last name)


5. Follow the format of the "Sample Program" below with the first and last lines appearing as shown. Also, be sure to use line skipping and spacing the way I show below.

Module Documentation Requirement

You MUST add Python Module Documentation to the the module .py program file

Running a Sample Program

Below is a example of how your program might run if you used the same answers to the prompts I used below. Your program should run in a similar manner... no matter what names (data) are entered.

NOTE: The data I entered appear in maroon bold


Sample Run...


Assignment 4


What is your first name?
First Name must be Entered

What is your first name?
First Name must be Entered

What is your first name? Steve

What is your last name?
Last Name must be Entered

What is your last name? Perry

What is your age?
Age must be Entered

What is your age? ff
Age must be a Number

What is your age? ss
Age must be a Number

What is your age? 55

Well, Steve Perry it looks like you are over the hill

END OF ASSIGNMENT 4

In: Computer Science

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

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

Points to remember:

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

• Include all the properties and methods on your diagram.

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

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

o Associations

o Dependencies

o Inheritance

o Aggregation

o Composition

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

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

static class GlobalValues
{
private static int maxStudentId = 100;

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

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

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

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

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

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

In: Computer Science

***IN JAVA*** Write a program contained a class Student which has firstName, lastName, mark, grade. The...

***IN JAVA***

Write a program contained a class Student which has firstName, lastName, mark, grade. The program should allow creation an array of object instances to assign firstName, lastName and mark from input user and perform and assign grade based on mark’s criteria displayed below.

MARKS

INTERVAL

95 - 100

90 - <95

85 - <90

80 - <85

75 - <80

70 - <75

65 - <70

60 - <65

0 - <60

LETTER GRADE

A+

A

B+

B

C+

C

D+

D

F

SAMPLE OF OUTPUT:

Enter section #: 1

How many students: 3

Enter student details:

First Name: John

Last Name: Kendall

Marks      : 96

Enter student details:

First Name: Mary

Last Name: Kendall

Marks      : 76

Enter student details:

First Name: Lucy

Last Name: Kendall

Marks      : 76

Result for Section 1

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

FirstName               Last Name         Grade

John                    Kendall           A+

Mary                    Kendall           C+

Lucy                    Kendall           C+

Total students: 3

Average marks: 82.2     Average Grade: B

Highest: 96, by John Kendall

Location: 0

Another batch? (Yes – 1, No - 0) :> 1

Enter section #: 2

How many students: 6

Enter student details:

1)

First Name: John

Last Name: Kendall

Marks      : 96

2)

First Name: Mary

Last Name: Kendall

Marks      : 76

3)

First Name: Lucy

Last Name: Kendall

Marks      : 76

4)

First Name: Martin

Last Name: Kendall

Marks      : 86

5)

First Name: Mary

Last Name: Kendall

Marks      : 76

6)

First Name: Lucy

Last Name: Kendall

Marks      : 98

Result for Section 2

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

FirstName               Last Name         Grade

John                    Kendall           A+

Mary                    Kendall           C+

Lucy                    Kendall           C+

Martin                  Kendall           B+

Mary                    Kendall           C+

Lucy                    Kendall           A+

Total students: 6

Average marks : 80.7    Average Grade: B

Highest: 98, by Lucy Kendall

Location: 6

           

Another batch? (Yes – 1, No - 0) :> 0

     

PROBLEM SOLVING TIPS:

Num

Tips

Grade

a)

Use class Student to create another class Students that will be built in the class implementing a Comparator.

/1m

b)

Use for enhanced method to display the grade of student by each batches

/1m

c)

In the main program, create sections of studlist, receive section number and number of students for each section. Use loop control structure to display output as shown in above and to assign input utilizing the studList structure.

/3m

d)

For each section, program will control input firstname, lastname and marks received from user and add into StudList.

/2m

e)

Use appropriate control structure to control input and program execution.

/4m

f)

In main, use Arrays sort() method, to help find the maximum grade achieved by each class and display the name of the student.

/3m

g)

In main, find the average performance (average section, mark and grade) of every batch and include in the output display.

Formula :

Average_mark = total/number of students;

/2m

h)

Use solution for practical provided to extend the program to capable to process more than one sections of students to process.

/ 4m

TOTAL:

/20m

In: Computer Science

Assume you are a vice-president in charge of a new business-to-business e-commerce division of a well-known...

Assume you are a vice-president in charge of a new business-to-business e-commerce division of a well-known major international auto parts manufacturer.

A) A cyber squatter has registered the company name as a domain Web name. What are your options to secure the domain name for your company?

B) Discuss the steps you should take to ensure worldwide protection of your domain name.

In: Computer Science

A researcher designs an experiment to measure the effectiveness of the new ointment in treating shingles....

A researcher designs an experiment to measure the effectiveness of the new ointment in treating shingles. Singles is a very serious, painful disease. A medical doctor examines the sixteen voluntary subjects. She finds four of subjects each with a moderate case of shingles and of these two are females and two are males. The other twelve subjects each have a severe case of shingles and of these eight are females and 4 are males. All subjects are aged 50 to 60, and except for shingles are in good health. For the standard ointment treatment, the doctor knows that females tend to respond better to the treatment than males do.

The statistician in charge of designing the experiment decides to conduct a double blind experiment using two treatment groups of subjects. Neither the doctor nor any of the subjects will know who receives which ointment. The control group will receive the standard ointment treatment for which the effectiveness is well known. The experimental group will receive new ointment. The two ointments are in identical tubes and both ointments appear identical. The subjects will receive detailed instructions on the application of the ointment. Each subject will apply the same amount of ointment three times a day, which is the recommended dosage of the standard ointment. They will have weekly follow up visits over two months after which the experiment will end. During weekly follow-up visits the doctor will assess if patients are correctly applying the ointment and use a Likert scale from 0, 1, 2, 3, to 4 to judge the severity of the rash with 0 indicating no rash and 4 a very severe rash.

Because males and females tend to respond differently to the standard treatment, the researcher must block males and females into a block of all males and another block of all females. For the male block, he randomly assigns one male with moderate case of shingles to new ointment treatment and the other male to the standard ointment treatment. Likewise, he randomly randomly assigns two of males with a severe case to new ointment treatment and the other two to the standard ointment treatment. Similarly, for the female block, he randomly assigns one moderate case to each of the two treatments. In addition, he randomly assigns four of females with a severe case to new ointment treatment and the other four to the standard ointment treatment. He runs the experiment for two months. For both males and females within each block and between each block, he compares how well and how fast the new ointment and the standard ointment work.

A.Why did the design not include a placebo?

B. Does the lack of a placebo put the results into question?

C. Do you see any design flaws in the original design?

Assume individuals with other serious health problems like cancer have a much harder time curing shingles than otherwise healthy individuals and that generally people older than 70 are also harder to cure.

4) When the experiment is replicated, should this additional information be taken into account? Describe how this would affect the design of the experiment.

In: Statistics and Probability