Questions
I need a sample of code of the below senario in Java with Spring Boot framework...

I need a sample of code of the below senario in Java with Spring Boot framework

Create a login and register page and user be able to register and then log in.

Data need to be stored from the user are:

Id, First Name, Last Name, DOB, Email, and Phone Number.

if user inputs the wrong credential system displays error.

please use JSPs. and JSTL dependencies

In: Computer Science

Python program problem: A group of statisticians at a local college has asked you to create...

Python program problem:

A group of statisticians at a local college has asked you to create a set of functions that compute the median and mode of a set of numbers. Define these functions, median and mode, in a module named stats.py. Also include a function named mean, which computes the average of a set of numbers. Each function should expect a list of numbers as an argument and return a single number. Each function should return 0 if the list is empty. Include a main function that tests the three statistical functions using the following list defined in main: userList = [3, 1, 7, 1, 4, 10] An example of the program output is shown below: List: [3, 1, 7, 1, 4, 10] Mode: 1 Median: 3.5 Mean: 4.33

In: Computer Science

package imageblocks; import java.awt.Color; import utils.Picture; public class ImageBlocks { static Color BLACK = new Color(0,0,0);...


package imageblocks;

import java.awt.Color;

import utils.Picture;

public class ImageBlocks {
static Color BLACK = new Color(0,0,0);
static Color WHITE = new Color(255,255,255);
private int height;
private int width;
boolean [][] visited;
Picture pic;
  
public ImageBlocks(Picture pic) {
   this.pic = pic;
   height = pic.height();
   width = pic.width();
}
  
  
private boolean isBlack(int x,int y){
return pic.get(x,y).equals(BLACK);
}
private boolean isWhite(int x,int y){
return pic.get(x,y).equals(WHITE);
}
  
/**

* METHOD TO BE COMPLETED
* count the number of image blocks in the given image
* Counts the number of connected blocks in the binary digital image
* @return number of black blocks
*/
public int countConnectedBlocks(){
       //TODO
   }

}

== Picture Class for Help ==

public final class Picture implements ActionListener {

private BufferedImage image; // the rasterized image

private JFrame frame; // on-screen view

private String filename; // name of file

private boolean isOriginUpperLeft = true; // location of origin

private final int width, height; // width and height

   /**

   * Initializes a blank <tt>w</tt>-by-<tt>h</tt> picture, where each pixel is black.

   */

public Picture(int w, int h) {

if (w < 0) throw new IllegalArgumentException("width must be nonnegative");

if (h < 0) throw new IllegalArgumentException("height must be nonnegative");

width = w;

height = h;

image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);

// set to TYPE_INT_ARGB to support transparency

filename = w + "-by-" + h;

}

   /**

   * Initializes a new picture that is a deep copy of <tt>pic</tt>.

   */

public Picture(Picture pic) {

width = pic.width();

height = pic.height();

image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

filename = pic.filename;

for (int x = 0; x < width(); x++)

for (int y = 0; y < height(); y++)

image.setRGB(x, y, pic.get(x, y).getRGB());

}

   /**

   * Initializes a picture by reading in a .png, .gif, or .jpg from

   * the given filename or URL name.

   */

public Picture(String filename) {

this.filename = filename;

try {

// try to read from file in working directory

File file = new File(filename);

if (file.isFile()) {

image = ImageIO.read(file);

}

// now try to read from file in same directory as this .class file

else {

URL url = getClass().getResource(filename);

if (url == null) { url = new URL(filename); }

image = ImageIO.read(url);

}

width = image.getWidth(null);

height = image.getHeight(null);

}

catch (IOException e) {

// e.printStackTrace();

throw new RuntimeException("Could not open file: " + filename);

}

}

   /**

   * Initializes a picture by reading in a .png, .gif, or .jpg from a File.

   */

public Picture(File file) {

try { image = ImageIO.read(file); }

catch (IOException e) {

e.printStackTrace();

throw new RuntimeException("Could not open file: " + file);

}

if (image == null) {

throw new RuntimeException("Invalid image file: " + file);

}

width = image.getWidth(null);

height = image.getHeight(null);

filename = file.getName();

}

   /**

   * Returns a JLabel containing this picture, for embedding in a JPanel,

   * JFrame or other GUI widget.

   */

public JLabel getJLabel() {

if (image == null) { return null; } // no image available

ImageIcon icon = new ImageIcon(image);

return new JLabel(icon);

}

   /**

   * Sets the origin to be the upper left pixel.

   */

public void setOriginUpperLeft() {

isOriginUpperLeft = true;

}

   /**

   * Sets the origin to be the lower left pixel.

   */

public void setOriginLowerLeft() {

isOriginUpperLeft = false;

}

   /**

   * Displays the picture in a window on the screen.

   */

public void show() {

// create the GUI for viewing the image if needed

if (frame == null) {

frame = new JFrame();

JMenuBar menuBar = new JMenuBar();

JMenu menu = new JMenu("File");

menuBar.add(menu);

JMenuItem menuItem1 = new JMenuItem(" Save... ");

menuItem1.addActionListener(this);

menuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,

   Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));

menu.add(menuItem1);

frame.setJMenuBar(menuBar);

frame.setContentPane(getJLabel());

// f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

frame.setTitle(filename);

frame.setResizable(false);

frame.pack();

frame.setVisible(true);

}

// draw

frame.repaint();

}

   /**

   * Returns the height of the picture (in pixels).

   */

public int height() {

return height;

}

   /**

   * Returns the width of the picture (in pixels).

   */

public int width() {

return width;

}

   /**

   * Returns the color of pixel (<em>x</em>, <em>y</em>).

   */

public Color get(int x, int y) {

if (x < 0 || x >= width()) throw new IndexOutOfBoundsException("x must be between 0 and " + (width()-1));

if (y < 0 || y >= height()) throw new IndexOutOfBoundsException("y must be between 0 and " + (height()-1));

if (isOriginUpperLeft) return new Color(image.getRGB(x, y));

else return new Color(image.getRGB(x, height - y - 1));

}

   /**

   * Sets the color of pixel (<em>x</em>, <em>y</em>) to given color.

   */

public void set(int x, int y, Color color) {

if (x < 0 || x >= width()) throw new IndexOutOfBoundsException("x must be between 0 and " + (width()-1));

if (y < 0 || y >= height()) throw new IndexOutOfBoundsException("y must be between 0 and " + (height()-1));

if (color == null) throw new NullPointerException("can't set Color to null");

if (isOriginUpperLeft) image.setRGB(x, y, color.getRGB());

else image.setRGB(x, height - y - 1, color.getRGB());

}

   /**

   * Is this Picture equal to obj?

   */

public boolean equals(Object obj) {

if (obj == this) return true;

if (obj == null) return false;

if (obj.getClass() != this.getClass()) return false;

Picture that = (Picture) obj;

if (this.width() != that.width()) return false;

if (this.height() != that.height()) return false;

for (int x = 0; x < width(); x++)

for (int y = 0; y < height(); y++)

if (!this.get(x, y).equals(that.get(x, y))) return false;

return true;

}

   /**

   * Saves the picture to a file in a standard image format.

   * The filetype must be .png or .jpg.

   */

public void save(String name) {

save(new File(name));

}

   /**

   * Saves the picture to a file in a standard image format.

   */

public void save(File file) {

this.filename = file.getName();

if (frame != null) { frame.setTitle(filename); }

String suffix = filename.substring(filename.lastIndexOf('.') + 1);

suffix = suffix.toLowerCase();

if (suffix.equals("jpg") || suffix.equals("png")) {

try { ImageIO.write(image, suffix, file); }

catch (IOException e) { e.printStackTrace(); }

}

else {

System.out.println("Error: filename must end in .jpg or .png");

}

}

   /**

   * Opens a save dialog box when the user selects "Save As" from the menu.

   */

public void actionPerformed(ActionEvent e) {

FileDialog chooser = new FileDialog(frame,

   "Use a .png or .jpg extension", FileDialog.SAVE);

chooser.setVisible(true);

if (chooser.getFile() != null) {

save(chooser.getDirectory() + File.separator + chooser.getFile());

}

}

In: Computer Science

Create a short list of ways to pop your filter bubble. What can be done to...

  1. Create a short list of ways to pop your filter bubble.
  2. What can be done to diversify the information you see on the internet and social media platforms?

In: Computer Science

*In Java Please! Tasks This assignment has three parts: Create a LinkedList class. Create a BirdSpecies...

*In Java Please!

Tasks

This assignment has three parts:

  1. Create a LinkedList class.
  2. Create a BirdSpecies class.
  3. Print out the results after testing each of the methods in both of the classes and solving a simple problem with them.

Task 1 – LinkedList Class

Create a LinkedList class. It may be singly linked, circularly linked, or doubly linked. A singly linked list may be in either direction, forwards or backwards, while a doubly linked list must be in both directions, forwards and backwards. A circularly linked list will connect the end with the beginning, instead of pointing to null, but otherwise it is a singly linked list. We will need at least one private variable which represents the starting point of our list. The nodes for this list will need the typical private fields of next and data, but also count which will store the number of times a specific species of bird has appeared in a survey.

We must also create a constructor for our LinkedList. Let’s create a default constructor that creates a list of size zero.

Next is to create an Add method. This will add the given BirdSpecies object to the end of the list, if the species is not already in the list. If it is in the list, then the variable count of that species is increased by one (remember that count comes from the node, not the list or BirdSpecies class). Also keep track of the position where a new BirdSpecies was added into the list. This will be returned to the Main method.

Another method called GetCount that returns the count of a given BirdSpecies. If that species is not on the list, return zero.

Finally, a GetReport method that returns the name and count of each BirdSpecies on the list. If the list is empty, return a special message that says the list is empty.

Task 2 – BirdSpecies Class

Create a BirdSpecies class that has private variables for the name of the species. Use an overloaded constructor to create a BridSpecies with a given name. Also use a getter and setter that manipulate the name. Finally, let’s make a ToString method that returns the name of the species.

Task 3 – The Tester Class

            Create a Tester Class, with a Main method. In the Main method, create one LinkedList object. The values will be entered into the LinkedList using user input and a loop. The loop will keep accepting user input until they enter “done” when asked if they wish to enter another bird species. If the user enters a new bird species into the list, use the ToString method of the new BirdSpecies object to display its name along with the position that it now has in the list. If another bird of the same species is added to the list, display the ToString method of the original BirdSpecies object and its count (but not its position). Finally, print out the list using the GetReport method of the LinkedList.

∃ Some Sample Output:

Enter a bird species: Black-chinned hummingbird

Entered bird species: Black-chinned hummingbird at position 0.

Are you done entering birds? no

Enter a bird species: West African swallow

Entered bird species: West African swallow at position 1.

Are you done entering birds? no

Enter a bird species: Black-chinned hummingbird

Entered bird species: Black-chinned hummingbird, count increased to 2.

Are you done entering birds? done

Contents of the list:

Black-chinned hummingbird with count 2

West African swallow with count 1

You need to implement your sourcecode into the given template below:

//Template for Class BirdSpecies------------------------------------------------------------------

package com.company;
public class BirdSpecies
{
private String nameOfSpecies;
public BirdSpecies(String nameOfSpecies)
{
//Initialize the name of the bird.
}
public void SetName(String name)
{
//Change the name of the bird.
}
public String GetName()
{
//Return the name of the bird.
}
@Override
public String toString()
{
//Return the name of the bird.
}
}

// Template for Class LinkedList-------------------------------------------------------------------------------------

package com.company;

public class LinkedList
{
private Node first;

public LinkedList()
{
this.first = null;
}

public int Add(Type data)
{
//CASE 0: List is empty or first is the same species.


//CASE 1: List is not empty, search for species as we move to the end of the list,
// otherwise add at end.
}

public int GetCount(Type data)
{
//Search through the list looking for the value given.
//Otherwise return 0 if we reached the end.
}

public String GetReport()
{
//CASE 0: List is empty, return a special message.

//CASE 1: List is not empty, return the species and count of each bird.
//Hint, use the toString of the bird to do so.
}

//Simple Node Class
class Node
{
E data;
Node next;
int count;

public Node(E data)
{
this.data = data;
this.next = null;
this.count = 1;
}
}
}

//Template for Main Class (No change needed here)-------------------------------------------------------

package com.company;

public class Main
{
public static void main(String[] args)
{
LinkedList list = new LinkedList<>();

System.out.println("Entered the black chin at: " + list.Add(new BirdSpecies("Black-chinned hummingbird")));
System.out.println("Entered the African swallow at: " + list.Add(new BirdSpecies("West African Swallow")));
System.out.println("Entered the second black chin at: " + list.Add(new BirdSpecies("Black-chinned hummingbird")));
System.out.println("Entered the African swallow at: " + list.Add(new BirdSpecies("West African Swallow")));

System.out.println("Count of black chin is: " + list.GetCount(new BirdSpecies("Black-chinned hummingbird")) );

System.out.println(list.GetReport());
}
}

In: Computer Science

In this project you will be writing a C++ program that uses a stack to convert...

In this project you will be writing a C++ program that uses a stack to convert an evaluate infix expression. Compilers often use this type of parsing. Note that the infix expression might not be syntactically correct.

Before evaluating an infix expression, you need to check if its balanced, then convert it to a postfix expression then finally evaluate the postfix.

You need to implement three methods:

1. public static Boolean checkBalance(String infixExpression)
2. public static String convertToPostfix(String infixExpression) 3. public static Double evaluatePostfix(String postFix)

Refer to your text book and class notes for the corresponding algorithms to implement these methods.

You need to use your own Stack implemented using Linked structure not C++ STL Stack. Your program should prompt the user for an expression, detect how many variables are there in the expression and prompt the user for their values.

Sample infix/Postfix Conversion

Infix Expression

Postfix Expression

a+b

a b+

a + b*c

a bc *+

a *b^ c

a bc ^ *

a + b*c ^ d

a bc d^ *+

( a + b ) *c

a b+ c *

(a +b ) * c

a b+ c *

( a + b ) / (c – d )

a b+ c d - /

( a + b * c^ d )^ ( e *f – g ^ h )

a b c d ^ * +e f * g h^ - ^

( a +b * c^ d ) ^( e* f– g h)

None. Invalid syntax. (What’s missing?)

a / b * c / d + ( e*f / g ^ h ) * (i – j)

a b / c * d / e f * g h^ / i j - * +

Sample input/output:

Enter your infix expression:
a+b*c
Your expression has 3 variables, please enter the value of variable 1: 3
please enter the value of variable 2:
6
please enter the value of variable 3:
28
Your equivalent postfix is:

abc*+
The evaluation is = 171.00

PLEASE ANSWER THE FOLLOWING IN C++!! I DON'T UNDERSTAND THE PROBLEM AT HANDS!! I WILL UPVOTE FOR WHOEVER ANSWERS IT CORRECTLY!! READ THE PROBLEM CAREFULLY!!!

In: Computer Science

can anyone give me an example of an Array and its usage in Visual Basic programming

can anyone give me an example of an Array and its usage in Visual Basic programming

In: Computer Science

I struggle with javascript but for this assingment, I was supposed to create a website with...

I struggle with javascript but for this assingment, I was supposed to create a website with at least 10 HTML files, of course with javascript included. I may be confused but not sure what is the difference between HTML Files and tags. I know what tags are but may have misunderstood the assignment with HTML files.

Your final project is to develop a web site of your choice. It is entirely up to you on what type of web site you want to develop. In the past, I saw students developed their personal web site, a site they developed for their work, family, church, or a site that promoted a friend's business, etc. The choice is yours. Your site must have the following features:

  • Contains at least 10 different HTML files
  • Use of Style Sheet
  • Use of JavaScript
  • Use of images
  • Contain at least one form

Some functionality of your web site can be only a prototype, but not fully functioning. For example, you might have a "Contact Us" page that allows users to send an email to your company. The page will have several input fields, such as Name, Subject, Message, and a Send button. However, when clicking on the Send button, no email is actually sent out. Similarly, you might create a payment processing page that allows the user to enter payment information, such as credit card number, expiration date, etc. But no payment is processed after the user clicks on the submit button.

In: Computer Science

Reflect on the Ellen Moore (A) case in light of what you've read this week on...

Reflect on the Ellen Moore (A) case in light of what you've read this week on conflict and in the previous module and answer the following questions:

  • Identify specific conflict points in the case. What kinds of communication strategies might have helped ease the conflict?
  • Consider the case in light of the PMI’s Code of Ethics and Professional Conduct. In what ways does that code help you think about the case?
  • How do you think the situation would have been different if all of this had been happening at a U.S. company in the U.S.? Would different communication and conflict management strategies have been more appropriate?

In: Computer Science

Given a file of birthdays in the format YYYY-MM-DDTHH:mm:ss:sss. Using C++ write a program to find...

Given a file of birthdays in the format YYYY-MM-DDTHH:mm:ss:sss.

Using C++ write a program to find the:

Age and bday of the oldest individuals in the file.

Age and bday of the youngest individual in the file.

Standard deviation of the ages with respect to 3/29/2019.

Average age with respect to 3/29/2019.

In: Computer Science

For each of the following program fragments, give an analysis of the running time (Big-Oh will...

For each of the following program fragments, give an analysis of the running time (Big-Oh will do).

Give the exact value leading to the Big-Oh conclusion, and show your work.

sum = 0; //1

for( i = 0; i < n; ++i )

++sum;

sum = 0; //2

for( i = 0; i < n; ++i )

for( j = 0; j < n; ++j )

++sum;

sum = 0; //3

for( i = 0; i < n; ++i )

for( j = 0; j < n * n; ++j )

++sum;

sum = 0; //4

for( i = 0; i < n; ++i )

for(j = 0; j < i; ++j )

++sum;

sum = 0; //5

for( i = 0; i < n; ++i )

for( j = 0; j < i * i; ++j )

for( k = 0; k < j; ++k )

++sum;

In: Computer Science

how backdoors can affect security? How can you mitigate this risk?

how backdoors can affect security?

How can you mitigate this risk?

In: Computer Science

In C++ Antique Class Each Antique object being sold by a Merchant and will have the...

In C++

Antique Class

Each Antique object being sold by a Merchant and will have the following attributes:

  • name (string)
  • price (float)

And will have the following member functions:

  • mutators (setName, setPrice)
  • accessors (getName, getPrice)
  • default constructor that sets name to "" (blank string) and price to 0 when a new Antique object is created
  • a function toString that returns a string with the antique information in the following format
<Antique.name>: $<price.2digits>

Merchant Class

A Merchant class will be able to hold 10 different Antique objects and interact with the user to sell to them. It should include the following attributes:

  • antiques (array): An Antique array of 10 objects
  • quantities (array): An Integer array representing the quantity of each Antique object in stock. This can range from 0 to 10.
  • revenue (float): variable used to store the total amount of money earned by the Merchant after each sale

And will have the following member functions:

  • Merchant (constructor): the constructor takes as arguments an array of Antiques and an array of quantities to use them to initialize antiques and quantities. revenue should be set to 0.
  • haggle: function that decreases each and every Antique object's price by 10%. It will print the following:
You have successfully haggled and everything is 10% off.

Customer cannot haggle more than once. If he tries to haggle more than once, it will print the following:

Sorry, you have already haggled.

In: Computer Science

C Programming: Problem 1: Write a function that returns the index of the largest value stored...

C Programming:

Problem 1:

Write a function that returns the index of the largest value stored in an array-of- double. Test the function in a simple program

Problem 2:
Write a function that returns the difference between the largest and smallest elements of an array-of-double. Test the function in a simple program

In: Computer Science

Design, implement and test a C++ class to work with real numbers as rational numbers called...

Design, implement and test a C++ class to work with real numbers as rational numbers called class "Rational". The data members are the numerator and denominator, stored as integers. We have no need for setters or getters (aka mutators or accessors) in the Rational class. All of our operations on rational numbers involve the entired number, not just the numerator or denominator."

  • <<" and">>" (i.e., input and output). It's a design decision as to when to "normalize" a rational number. The numerator and denominator will be in "lowest terms" and only the numerator may be negative. For example, if we were given as input 4/-8, we would store and display it as -1/2. Simililarly -8/-6 would turn into 4/3. Thus when they are first created, they must be stored as normalized and any operation that might change a number must also normalize it. We will maintain the numbers in their normalized form at all times. Either (or both) of the numerator and the denominator may be input as negative integers. The following are all possible inputs: 1/2, -1/-2, -1/2 and 1/-2. Rational numbers are read and written as an integer, followed by a slash, and followed by an integer.
  • "+=" operator must be implemented as a member function, aka method. "+" operator must be implemented (ie., addition) as a non-member function that calls the "+="operator. Do not make "+" operator a friend."==" operator must be Implement as a non-member. "!=" operator must be implemented as non-member, but not as a friend.
    • "++" operator and "--" operator must be:
      • Both pre- and post-.
      • Member for "++" operator
      • Non-member, non-friend for "--" operator
    • "<" operator must be non-member
    • "<=" , ">" and ">=" operators must be implemented as non-member and non-friend.
  • Make it possible to write "if (r) {}", where r is a Rational number. Use the code given below to compute the greatest common divisor of two non-negative integers, that should be useful for writing the normalize function:

Code:

int greatestCommonDivisor(int x, int y) {
while (y != 0) {
int temp = x % y;
x = y;
y = temp;
}
return x;
}

In: Computer Science