Questions
Write a method named minimumValue, which returns the smallest value in an array that is passed...

Write a method named minimumValue, which returns the smallest value in an array that is passed (in) as an argument. The method must use Recursion to find the smallest value. Demonstrate the method in a full program, which does not have to be too long regarding the entire code (i.e. program). Write (paste) the Java code in this word file (.docx) that is provided. (You can use additional pages if needed, and make sure your name is on every page in this word doc.) Use the following array to test the method: int[] series array = {-5, -10, +1999, +99, +100, +3, 0, +9, +300, -200, +1, -300} Make sure that the series array only tests for values, which are positive, given your recursive method.

Part II (25 points) Algorithmic Performance as you are aware, consists (mainly) of 2 dimensions: Time and Space. From a technical perspective, discuss the following:  Regarding runtime, discuss algorithmic performance with respect to its runtime performance. As you develop an algorithm, what must you also consider in terms of some of the trade-offs? How would you go about estimating the time required for an algorithm’s efficiency (i.e. time to complete in terms of its potential complexity)? What techniques can you use? Give an example of how to measure it.

In: Computer Science

What are the data structures. How these are useful in different fields of computer science. Discuss...

What are the data structures. How these are useful in different fields of computer science. Discuss at least three fields.

In: Computer Science

Create Lab project Add the following codes to your main method. Compile and run the program...

  1. Create Lab project
  2. Add the following codes to your main method. Compile and run the program with some arguments and observe the output.

      printf("You have entered %d arguments.\n", argc);

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

        printf( "argument %d: %s\n",i+1,argv[i]);

  1. Create a function called simpleFileWrite() and add the following feature: Open a write only file called “myfile.txt” and write characters into it. The set of characters are read form the keyboard until cntrl-z is entered. (use putc() and getc() function; in your c code use EOF to compare with cntrl-z).
  2. Compile, build and run the program. Now print the file contents on the console using the linux command “cat myfile.txt” and observe the contents.
  3. Create a function called simpleFileRead() and add the following feature: Open the file “myfile.txt” as a read only file from within your program and read characters from it and print it on the console using the printf command.
    1. Also count the number of characters in the file
    2. Observe the output to compare whether it matches with the entries that you made from the keyboard earlier.
  4. Create a function called stringHandler() and add the following feature: Write set of strings each of length 40 into a file “stringc.txt”. Close the file and then reopen to read. Now display the contents of the file (use fputs() and fgets() function).
  5. Create a function called mixedDataHandler() and the add the following feature: Write name, age and height of a person into a data file “person.txt”. Close the file and reopen it to read from it (use fprintf() and fscanf() function).
  6. Create a C file called myCopy.c, which will process command line arguments. The first argument will be the name of the program itself, the second argument will be the source file to copy from, and the 3rd argument will be the destination file to copy to. If the user doesn’t provide argument 2 then show error message that “Source file name needed”. If the user does not provide the 3rd argument then use “default.txt” as the name of the output file.

please help me, this is c programming. thank you in advance.

In: Computer Science

The purpose of this assignment is to analyze data and use it to provide stakeholders with...

The purpose of this assignment is to analyze data and use it to provide stakeholders with potential answers to a previously identified business problem.

For this assignment, continue to assume the role of a data analyst at Adventure Works Cycling Company. Evaluate the data associated with the drop in sales for the popular model "LL Road Frame-Black 60." Provide a hypothesis on what could be contributing to the falling sales identified in the initial business problem presented by your manager.

In 250-500 words, share these recommendations in a Word document that addresses the following.

  1. Summary of the business problem including the requestor who initially brought the problem to you.
  2. Summary of the data that were requested and how they was obtained.
  3. Discussion of the limitations of the available data and ethical concerns related to those limitations.
  4. Hypothesis of why sales of the popular model have dropped based upon data analysis. Reference the Excel file that summarizes the data findings that resulted from your queries.
  5. Recommendations for addressing the business problem.
  6. In addition to the report, the manager has requested that you submit the Excel files summarizing the data findings that resulted from your queries.
  7. The manager has also requested that you update the ERD you created in the Topic 5 assignment to include the tables generated as a result of the joins completed in the Topic 6 assignment. The ERD should clearly document the work stream and relationships.

In: Computer Science

1 Problem Description This lab will cover a new topic: linked lists. The basic idea of...

1 Problem Description

This lab will cover a new topic: linked lists. The basic idea of a linked list is that an address or a pointer value to one object is stored within another object. By following the address or pointer value (also called a link), we may go from one object to another object. Understanding the pointer concept (which has be emphasized in previous labs and assignments) is crucial in understanding how a linked list operates.

Your task will be to add some code to manipulate the list.

2 Purpose

Understand the concept of linked lists, links or pointers, and how to modify a linked list.

3 Design

A very simple design of a node structure and the associated linked list is provided lab7.cpp. Here is the declaration:

typedef int element_type; 

struct Node 

{ 

    element_type elem; 

    Node * next;

    Node * prev; // not used for this lab 

}; 

Node * head; 

NOTE: A struct is conceptually the same thing as a class. The only significant difference is that every item (each method and data field) is public. Structs are often used as simple storage containers, while classes encompass complex data and methods on that data. Nodes of a linked list are good examples of where a struct would be useful.

Since head is a pointer that points to an object of type Node, head->elem ( or (*head).elem ) refers to the elem field. Similarly, head->next refers to the next field, the value of which is a pointer and may point to another node. Thus, we are creating a chain of Nodes. Each node points to the next Node in the chain.

Note that in our program head should always points to the first node of the linked list. For a linked list that has no elements (an empty list), the value of head is NULL. When working with linked lists, it is usually helpful to draw them out in order to understand their operation.

4 Implementation

Note that this file contains a show() function that will display the contents of a linked list in order. As with previous labs, you must call show() after each of the following steps.

  1. Remove the first element from the linked list. Make sure to free the space for the Node correctly, and make sure that head is now pointing to the correct node in the list. When your code is working, you should see the node sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15].
  2. Remove the last element from the list, assuming that we do not know how many nodes are in the linked list initially. Make sure to free the space and set the pointers correctly. Hint: we need to traverse the list to find the second to last Node. Once we have the pointer to that node we can safely remove the last node. One way to accomplish this is to store both a current pointer that points to the current node in the chain, and a previous pointer that points to the node containing the last element we saw. The previous pointer follows the current pointer through the list. When your code is working, you should see the node sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14].
  3. Insert ten elements (0 to 9 for element values) to the beginning of the current linked list, each being placed at the beginning. You must use a loop here (so we can easily change the action to insert 1000 elements (0 to 999) for instance). When your code is working, you should see the node sequence [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]. The basic procedure is to create a new node, set its next pointer to the head of the list, and then move the head to your new node.
  4. Insert ten elements (0 to 9 for element values) after the first node having value 7 in the current linked list. You will need to loop through the list to find the node that has 7 (again, do not assume you know where the 7 is. You should search for it.) Once you find the correct starting point, you will need to integrate your new nodes into the list one at a time. When your code is working, you should see the node sequence [9, 8, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]. One possible procedure will be to first get the node after 7 (e.g. the first node containing a 6, note that current points to the node of 7 in the search is assumed in the following), and make variable “end” points to the node. Create a new node with proper value, set this node's next to the end (node 6), set current's next to the new node. Depending on the order of inserting these values, we may either update end so that it points to the new node or move current so that it points to the new node. Then repeat creating a new node action.

Please write in C++

Basic Linked Lists Starter Code:

#include <cstdlib>
#include <iostream>

using namespace std;

// Data element type, for now it is int, but we could change it to anything else
// by just changing this line
typedef int element_type;

// Basic Node structure
struct Node
{
    element_type elem;  // Data
    Node * next;        // Pointer to the next node in the chain
    Node * prev;        // Pointer to the previous node in the chain, not used for lab 7
};

// Print details about the given list, one Node per line
void show(Node* head)
{
    Node* current = head;
    
    if (current == NULL)
        cout << "It is an empty list!" << endl;
    
    int i = 0;
    while (current != NULL) 
    {
        cout << "Node " << i << "\tElem: " << '\t' << current->elem << "\tAddress: " << current << "\tNext Address: " << current->next << endl;
        current = current->next;
        i++;
    }
    
    cout << "----------------------------------------------------------------------" << endl;
}

int main() 
{
    const int size = 15;

    Node* head    = new Node();
    Node* current = head;

    // Create a linked list from the nodes
    for (int i = 0; i < size; i++)
    {
        current->elem = i;
        current->next = new Node();
        current       = current->next;
    }
    
    // Set the properties of the last Node (including setting 'next' to NULL)
    current->elem = size;
    current->next = NULL;
    show(head);

    // TODO: Your Code Here Please use show(head); after completing each step.
STEP 1:


STEP 2:


STEP3:    


STEP 4:

    // Clean up
    current = head;
    while (current != NULL)
    {
        Node* next = current->next;
        delete current;
        current = next;
    }
    
    return 0;
}

In: Computer Science

Write a javascript code to Create a function called Hotel that takes Room no, Customer name....

Write a javascript code to Create a function called Hotel that takes Room no, Customer name. amount paid. Write a code to call hotel function for each customer and display details of customers lodging in rooms with even room numbers.
I need only js and html code. no css
pls take screenshot of output , else I might dislike
thanks

In: Computer Science

Define a class for the student record. The class should instance variables for Quizzes, Midterm, Final...

Define a class for the student record. The class should instance variables for Quizzes, Midterm, Final and total score for the course and final letter grade.

The class should have input and output methods. The input method should not ask for the final numeric grade, nor should it ask for final letter grade. The classes should have methods to compute the overall numeric grade and the final letter grade. These two methods will be void methods that set the appropriate instance variables.

Make sure to add default constructor.

Your program should use all the described methods. You should have set of Accessor(getter) and mutator(setter) methods for all instance variables, whether your program uses them or not.

The program should read in the students’ scores two quizzes, midterm and final and display the student’s records, which consists of all the above +final number and final letter grade.

Overall numeric grade is calculated as 50%-final exam, 25%-midterm and two quizzes together count for 25%.

For letter grade

90-100 is A

80-89 is B

70-79 is C

60-69 is D

And any grade <60 is F grade

When taking input, quiz grades are out of 10 points and midterm and final are out of 100 points.

In: Computer Science

Your mission is to create your own application with the following minimum requirements: A JFrame and...

Your mission is to create your own application with the following minimum requirements:
A JFrame and a (non-modal) JDialog.
A JTabbedPane and JScrollPane.
Nested JPanels including the following layout managers: GridLayout, FlowLayout, BorderLayout
Some interaction widgets (JButton, etc.) on every JPanel and tab.
Reasonable behavior when the JFrame is resized.
NOTE: You may not use GridBagLayout, Free Design, Box, Overlay, Null or Absolute Layout anywhere in the project.

In: Computer Science

Implementation of a a queue with a "circular" array or a "regular" array. (a) "circular" array:...

Implementation of a a queue with a "circular" array or a "regular" array.

(a) "circular" array: consider using the smallest number of fields/variables in a struct/class. List the fields/variables that support the enqueue and dequeue operations in O(1) time in the worst case. Explain why the list is the smallest and the two operations are O(1) time.

(b) "regular" array: explain the worst-case time complexity in big-O for the operations (queue size is at most n).

In: Computer Science

Assume that the following relationships were created in a database. CUSTOMER (CustomerNumber, CustomerLastName, CustomerFirstName, Phone) COURSE...

Assume that the following relationships were created in a database.

CUSTOMER (CustomerNumber, CustomerLastName, CustomerFirstName, Phone)

COURSE (CourseNumber, CourseTitle, TeachingMode, CourseCreationDate, Fee)

ENROLLMENT (EnrollmentID, CustomerNumber, CourseNumber, EnrollmentDate, AmountPaid)

Legend:
Primary Key

Foreign Key

Possible values

TeachingMode: PRE - Presencial, ONL - Online


Write the SQL (ORACLE) statements required to complete what is required below. Provide ONE instruction per request / question. Write your answers in the space provided. Identify each answer with the corresponding request / question number.

1. Create the CUSTOMER table include the constraints 
2. Create the COURSE table include the constraints 
3. Create the ENROLLMENT table include the constraints 
4. Create the sequence seqEnroll 
5. Insert a row in the CUSTOMER table. 
6. Insert a row in the COURSE table. 
7. Insert a row in the ENROLLMENT table. The primary key field is a substitute (Surrogate / Artificial) so it will use the sequence you created in statement 4. The transaction must belong to the CUSTOMER you created in # 5 and the COURSE you created in # 6. 
8. List customers in ascending alphabetical order by last name. Include the following information in this order: last name, first name and telephone number 
9. List all the courses that have the word Pastels in the title. Include all the data in the COURSE table. 
10. List all the courses the clients are enrolled in. Include the following data in this order: CustomerNumber, CourseNumber, and AmountPaid. 
11. List all courses that started on or before October 1, 2018. Include the following data in this order: CourseDate, CourseNumber, CourseTitle, Fee. 
12. Show for each client the total paid for classroom courses and total paid for online courses TeachingMode the total paid by each client. 
Show courses that are cheaper than the average price Use subquery and functions. 
13. List all course information if you have had at least ten clients enrolled in the past twelve months. It must work at any time, the twelve-month period will depend on the date the consultation is run. DO NOT USE SPECIFIC DATES. Use subquery and functions.

In: Computer Science

Hello, I need an expert answer for one of my JAVA homework assignments. I will be...

Hello, I need an expert answer for one of my JAVA homework assignments. I will be providing the instructions for this homework below:

For this lab, you will write the following files:

  • AbstractDataCalc
  • AverageDataCalc
  • MaximumDataCalc
  • MinimumDataCalc

As you can expect, AbstractDataCalc is an abstract class, that AverageDataCalc, MaximumDataCalc and MinimumDataCalc all inherit.

We will provide the following files to you:

  • CSVReader
    A simple CSV reader for Excel files
  • DataSet
    This file uses CSVReader to read the data into a List> type structure. This of this as a Matrix using ArrayLists. The important methods for you are rowCount() and getRow(int i)
  • Main
    This contains a public static void String[] args. You are very free to completely change this main (and you should!). We don't test your main, but instead your methods directly.

Sample Input / Output

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

Given the following CSV file

1,2,3,4,5,6,7
10,20,30,40,50,60
10.1,12.2,13.3,11.1,14.4,15.5

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

The output of the provided main is:

 Dataset Results (Method: AVERAGE)
 Row 1: 4.0
 Row 2: 35.0
 Row 3: 12.8

 Dataset Results (Method: MIN)
 Row 1: 1.0
 Row 2: 10.0
 Row 3: 10.1

 Dataset Results (Method: MAX)
 Row 1: 7.0
 Row 2: 60.0
 Row 3: 15.5

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

Specifications

You will need to implement the following methods at a minimum. You are free to add additional methods.

AbstractDataCalc

  • public AbstractDataCalc(DataSet set) - Your constructor that sets your dataset to an instance variable, and runCalculations() based on the dataset if the passed in set is not null. (hint: call setAndRun)
  • public void setAndRun(DataSet set) - sets the DataSet to an instance variable, and if the passed in value is not null, runCalculations on that data
  • private void runCalculations() - as this is private, technically it is optional, but you are going to want it (as compared to putting it all in setAndRun). This builds an array (or list) of doubles, with an item for each row in the dataset. The item is the result returned from calcLine.
  • public String toString() - Override toString, so it generates the format seen above. Method is the type returned from get type, row counting is the more human readable - starting at 1, instead of 0.
  • public abstract String getType() - see below
  • public abstract double calcLine(List line) - see below

AverageDataCalc

Extends AbstractDataCalc. Will implement the required constructor and abstract methods only.

  • public abstract String getType() - The type returned is "AVERAGE"
  • public abstract double calcLine(List line) - runs through all items in the line and returns the average value (sum / count).

MaximumDataCalc

Extends AbstractDataCalc. Will implement the required constructor and abstract methods only.

  • public abstract String getType() - The type returned is "MAX"
  • public abstract double calcLine(List line) - runs through all items, returning the largest item in the list.

MinimumDataCalc

Extends AbstractDataCalc. Will implement the required constructor and abstract methods only.

  • public abstract String getType() - The type returned is "MIN"
  • public abstract double calcLine(List line) - runs through all items, returning the smallest item in the list.

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

CSVReader.java


import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


public class CSVReader {
    private static final char DELIMINATOR = ',';
    private Scanner fileScanner;

  
    public CSVReader(String file) {
        this(file, true);
    }

  
    public CSVReader(String file, boolean skipHeader) {
        try {
            fileScanner = new Scanner(new File(file));
            if(skipHeader) this.getNext();
        }catch (IOException io) {
            System.err.println(io.getMessage());
            System.exit(1);
        }
    }

  
    public List<String> getNext() {
        if(hasNext()){
            String toSplit = fileScanner.nextLine();
            List<String> result = new ArrayList<>();
            int start = 0;
            boolean inQuotes = false;
            for (int current = 0; current < toSplit.length(); current++) {
                if (toSplit.charAt(current) == '\"') { // the char uses the '', but the \" is a simple "
                    inQuotes = !inQuotes; // toggle state
                }
                boolean atLastChar = (current == toSplit.length() - 1);
                if (atLastChar) {
                    result.add(toSplit.substring(start).replace("\"", "")); // remove the quotes from the quoted item
                } else {
                    if (toSplit.charAt(current) == DELIMINATOR && !inQuotes) {
                        result.add(toSplit.substring(start, current).replace("\"", ""));
                        start = current + 1;
                    }
                }
            }
            return result;
        }
        return null;
    }

  
    public boolean hasNext() {
        return (fileScanner != null) && fileScanner.hasNext();
    }

}

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

DataSet.java

import java.util.ArrayList;
import java.util.List;

public class DataSet {
    private final List<List<Double>> data = new ArrayList<>();


    public DataSet(String fileName) {
        this(new CSVReader(fileName, false));
    }

  
    public DataSet(CSVReader csvReader) {
        loadData(csvReader);
    }

  
    public int rowCount() {
        return data.size();
    }

  
    public List<Double> getRow(int i) {
        return data.get(i);
    }

  
    private void loadData(CSVReader file) {
        while(file.hasNext()) {
            List<Double> dbl = convertToDouble(file.getNext());
            if(dbl.size()> 0) {
                data.add(dbl);
            }
        }
    }

  
    private List<Double> convertToDouble(List<String> next) {
        List<Double> dblList = new ArrayList<>(next.size());
        for(String item : next) {
            try {
                dblList.add(Double.parseDouble(item));
            }catch (NumberFormatException ex) {
                System.err.println("Number format!");
            }
        }
        return dblList;
    }


  
    public String toString() {
        return data.toString();
    }
}

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

Main.java

public class Main {
  
    public static void main(String[] args) {
        String testFile = "sample.csv";
        DataSet set = new DataSet(testFile);
        AverageDataCalc averages = new AverageDataCalc(set);
        System.out.println(averages);
        MinimumDataCalc minimum = new MinimumDataCalc(set);
        System.out.println(minimum);
        MaximumDataCalc max = new MaximumDataCalc(set);
        System.out.println(max);
    }
  
}

In: Computer Science

Create an Employee class having the following functions and print the final salary in c++ program....

Create an Employee class having the following functions and print
the final salary in c++ program.
- getInfo; which takes the salary, number of hours of work per day
of employee as parameters
- AddSal; which adds $10 to the salary of the employee if it is less
than $500.
- AddWork; which adds $5 to the salary of the employee if the
number of hours of work per day is more than 6 hours.

In: Computer Science

Having those files please adjust the following tasks. When the user fills out the registration, all...

Having those files please adjust the following tasks.

When the user fills out the registration, all information is inserted into a database table.

When the user signs in, all information is verified from the database table.

You can either create your own table on your machine or use the demo server table for testing. Remember the table name and the fields must be exactly as shown below.

If you are using your own table, you must change the connection info as shown below before uploading to the demo server. Then you must test to make sure it works correctly on the demo server.

The table name will be 'account'.

The fields in the table are:

username - 20 char

password - 50 char

name - 20 char

email - 50 char

Make sure that all field names are the same upper and lowercase letters as shown above.

The password will still be encrypted when stored in the database.

You must insert data into the table using your program. Do not assume anything is on the table.

When creating userids and passwords, use something unique, as your classmates will be sharing the same table.

assignment3

<?php
session_start();   
if(isset($_SESSION['userid']))   
{
header("Location:home.php");   
}
include 'header.php';
?>

<?php

if(isset($_POST["register"]))   
{
// collect form data

$first_name=$_POST["first_name"];
$last_name=$_POST["last_name"];
$email=$_POST["email"];
$userid=$_POST["userid"];
$password=$_POST["password"];
$verify_password=$_POST["verify_password"];

if($password===$verify_password) // password verification
{

$hashFormat="$2y$10$"; // set hash
$salt ="iusesomecrazystrings22"; // set salt
$new_salt = $hashFormat . $salt; // concatenate hash and salt
$encrypted_password = crypt($password,$new_salt); // Encrypt the password

if(file_exists("users.txt")) // check file is exist or not
{
// Open a file for write only and append the data to an existing file

$myfile = fopen("users.txt", "a");

$mydata=$first_name."|".$last_name."|".$email."|".$userid."|".$encrypted_password."\r\n";

fwrite($myfile, $mydata);

include('send_mail.php');


}


else
{
$myfile = fopen("users.txt", "w"); // Open a file for write only

fwrite($myfile, "First Name |Last Name | Email| User Id | Password\r\n");

$mydata=$first_name."|".$last_name."|".$email."|".$userid."|".$encrypted_password."\r\n";

fwrite($myfile, $mydata);

include ("send_mail.php");

}


fclose($myfile);   

// set the message if password is verified

$register_msg = "The following registration information has been successfully submitted";
}
else
{
$register_msg = "password not match"; // set the message if password is not verified
}
}
else
{
$register_msg = "";   
}

?>

<html>

<body>   

<h1> <?php echo $register_msg; ?> </h1>   

<form action="assignment3.php" method="POST" style="float:left; width:50%;">
<fieldset>
<legend style="text-align: center;">User Information</legend>
<table style="margin:0px auto;">   
<tr>
<td>
<label> First Name</label>
</td>
<td>
<input type="text" name="first_name">   
</td>
</tr>
<tr>
<td>
<label> Last Name</label>   
</td>
<td>
<input type="text" name="last_name">
</td>
</tr>
<tr>
<td>
<label> Email</label>
</td>
<td>
<input type="email" name="email">   
</td>
</tr>
<tr>
<td>
<label> User ID</label>
</td>
<td>
<input type="text" name="userid">   
</td>
</tr>
<tr>
<td>
<label> Password</label>
</td>
<td>

<input type="password" name="password" pattern="(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,12}" title="Must contain at least one number and one special character, and length must between 8 to 12 characters">
</td>
</tr>
<tr>
<td>
<label> Verify Password</label>
</td>
<td>
<!--create a password field for Verify Password -->

<input type="password" name="verify_password" pattern="(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,12}" title="Must contain at least one number and one special character, and length must between 8 to 12 characters">
</td>
</tr>

<tr>
<td><input type="submit" name="register" value="Register"></td>
<td><input type="reset" name="reset" value="Reset"></td>
</tr>
</table>
</fieldset>
</form>   

<form action="home.php" method="POST" style="float:right; width:50%;">
<fieldset>   
<legend style="text-align: center;">Sign In</legend>
<table style="margin:0px auto;">   
<tr>
<td>
<label> User ID</label>
</td>
<td>
<input type="text" name="userid">   
</td>
</tr>
<tr>
<td>
<label> Password</label>
</td>
<td>

<input type="password" name="password" pattern="(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,12}" title="Must contain at least one number and one special character, and length must between 8 to 12 characters">
</td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Submit"></td>
<td><input type="reset" name="reset" value="Reset"></td>
</tr>
</table>   
</fieldset>   
</form>   

</body>
</html>

header.php

<!DOCTYPE html>
<html>
<head>
<title>Assignment3</title>
<link rel="stylesheet" type="text/css" href="main.css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<header>
<h1>Register for an Account</h1>
</header>

home.php

<?php

session_start();   

if(!isset($_POST["Submit"])&&!isset($_SESSION["userid"]))
{
header("Location:assignment3.php");   
}

if(isset($_POST['logout']))
{
  
session_unset();

// destroy the session
session_destroy();

header("Location:assignment2.php");
}

if(isset($_POST["Submit"])) // if Submit parameter exist
{
// collect form data

$userid=$_POST["userid"];
$password=$_POST["password"];

$hashFormat="$2y$10$"; // set hash
$salt ="iusesomecrazystrings22"; // set salt
$new_salt = $hashFormat . $salt; // concatenate hash and salt

$encrypted_password = crypt($password,$new_salt); // Encrypt the password entered by the user

$myfile = file ('./users.txt');

foreach($myfile as $row)
{   
$data = explode("|",$row);

// Compare the userid and password to what is in the text file

if($userid===$data[3] && $encrypted_password===trim($data[4]))
{
// Set session variables

$_SESSION['userid'] = $data[3]; // Set userid to session variable
$_SESSION['password'] = $data[4]; // Set password to session variable

// If password match, set display a welcome message to variable

$msg="Welcome ".$_SESSION['userid'];
}
else
{
// If password do not match, set display this message to variable

$msg="userid/password combo incorrect please reenter";
}
}
}
else
{
$msg="";
}
  
?>

<html>   
<body>
<h1> <?php echo $msg; ?> </h1>

<?php
if(isset($_SESSION["userid"]))   
{
?>

<form action="home.php" method="post">
<input type="submit" value="Sign Out" name="logout">
</form>

<?php
}
?>

</body>
</html>

css file

html {
background-color: #e6f2ff;
}
body {
font-family: Arial, Helvetica, sans-serif;
width: 900px;
margin: 0 auto;
padding: 0 1em;
background-color: white;
border: 1px solid blue;
}
header {
border-bottom: 2px solid black;
padding: .5em 0;
}
header h1 {
color: blue;
}
main {

}
aside {
float: left;
width: 150px;
}


h1 {
font-size: 150%;
margin: 0;
padding: .5em 0 .25em;
}
h2 {
font-size: 120%;
margin: 0;
padding: .75em 0 0;
}
h1, h2 {
color: black;
}

fieldset {
margin: 1em;
padding-top: 1em;
margin-left: 10px;
border: 1px solid blue;
  
}

label {
float: left;
width: 10em;
text-align: right;
margin-top: .25em;
margin-bottom: .5em;
}

input, select {
margin-left: 0.5em;
margin-bottom: 0.5em;
width: 14em;
}

br {
clear: both;
}
span {
vertical-align: middle;
}

.error {
color: #cc3300;
}

.notice {
color: #cc3300;
font-size: 50%;
text-align: right;
}

In: Computer Science

In C: You are to create a program to request user input and store the data...

In C:

You are to create a program to request user input and store the data in an array of structures, and then display the data as requested. The data you are collecting refers to a set of images. The images are OCT images taken of the lining of the bladder. The data you provide will help diagnose the image as cancerous or not, but your code does not need to do that at the moment.

1) Define a global structure that contains the following information:

a) File number (must be >0)

b) Diagnosis number (1-8)

c) Number of layers in the image

d) Maximum average intensity of a single row (should be a float)

e) Width of brightest layer

2) Declare an array of 9 of the structures in #1. This array should be a global variable.

3) Initialize each of the file numbers in the array to -1.

4) Create a loop that will continue asking the user for the above data until the file number 0 is given, or until information has been provided for 9 images.

5) If the user provides a file number less than 0, ask again. Do not ask for further information if the user provides a file number equal to 0.

6) If the user provides a diagnosis number that is not between 1 and 8, ask again.

7) Store the data in the array of structures in the order it is provided.

8) Write a function to display the information for a particular file number. If the file number was not found, nothing is displayed. The function will return a 1 if the file number was found or a 0 if the file number was not in the array.

9) In your main function, after the loop which requests the data, create another loop that will request a file number from the user and then call the function written for #8 to display the data for that file number. This loop will continue until a file number is provided that is not found.

10) In your main function, after the code for #9, add a loop that will display the information for all items stored in the array in order.

In: Computer Science

please recode this in c++ language public abstract class BankAccount { double balance; int numOfDeposits; int...

please recode this in c++ language

public abstract class BankAccount
{
double balance;
int numOfDeposits;
int numOfWithdraws;
double interestRate;
double annualInterest;
double monSCharges;
double amount;
double monInterest;

//constructor accepts arguments for balance and annual interest rate
public BankAccount(double bal, double intrRate)
{
balance = bal;
annualInterest = intrRate;
}

//sets amount
public void setAmount(double myAmount)
{
amount = myAmount;
}

//method to add to balance and increment number of deposits
public void deposit(double amountIn)
{
balance = balance + amountIn;
numOfDeposits++;
}

//method to negate from balance and increment number of withdrawals
public void withdraw(double amount)
{
balance = balance - amount;
numOfWithdraws++;
}

//updates balance by calculating monthly interest earned
public double calcInterest()
{
double monRate;

monRate= interestRate / 12;
monInterest = balance * monRate;
balance = balance + monInterest;
return balance;
}

//subtracts services charges calls calcInterest method sets number of withdrawals and deposits
//and service charges to 0
public void monthlyProcess()
{
calcInterest();
numOfWithdraws = 0;
numOfDeposits = 0;
monSCharges = 0;
}

//returns balance
public double getBalance()
{
return balance;
}

//returns deposits
public double getDeposits()
{
return numOfDeposits;
}

//returns withdrawals
public double getWithdraws()
{
return numOfWithdraws;
}
}
and the subclass

public class SavingsAccount extends BankAccount
{
//sends balance and interest rate to BankAccount constructor
public SavingsAccount(double b, double i)
{
super(b, i);
}

//determines if account is active or inactive based on a min acount balance of $25
public boolean isActive()
{
if (balance >= 25)
return true;
return false;
}

//checks if account is active, if it is it uses the superclass version of the method
public void withdraw()
{
if(isActive() == true)
{
super.withdraw(amount);
}
}

//checks if account is active, if it is it uses the superclass version of deposit method
public void deposit()
{
if(isActive() == true)
{
super.deposit(amount);
}
}

//checks number of withdrawals adds service charge
public void monthlyProcess()
{
if(numOfWithdraws > 4)
monSCharges++;
}
}

INSTRUCTIONS WERE:
Build a retirement calculator program using classes ( have sets and gets for classes ) including unit tests for the classes.

Create a class for BankSavings Account -

fixed interest rate ( annual rate ) ( this should be set via a function call )

add money

withdraw money


Class for MoneyInYourPocket

add money

withdraw money


Class for MarketMoney ( investment )

rate of return is a variable 4% +- 6% randomly each time we 'apply it' ( don't need to unit test this for now, wait till next week )

add money

withdraw money ( every time you withdraw money, you get charged a $10 fee )


Build the retirement simulator.

Ask the user how old they are, and what age they want to retire.

For each asset type, get a current balance.

for every year until they retire ( loops ),

apply the return on investment or interest rate.

print the current balance in each type

ask for additional savings or withdrawals ( for each account type )

Once you reach the retirement age, display the balances of each type.

Also, generate a grand total, and adjust it for inflation ( fixed 2% per year )

total / ( 1.02 ^ years )

question has been answered before, so dont know how it doesnt have "enough inputs"

In: Computer Science