Question

.Create a variable whose type is an array of that class you just previously created. Imagine that the array is initialized wi
0 0
Add a comment Improve this question Transcribed image text
Answer #1

create a project and paste this code app.component.ts file

Here is code:

Students.ts:

export class Student {

id: number;

first_name: string;

last_name: string;

email: string;

gender: string;

}

ts:

import { Component } from '@angular/core';

import { getViewData } from '@angular/core/src/render3/state';

import { Student } from './Student';

@Component({

selector: 'app-root',

templateUrl: './app.component.html',

styleUrls: ['./app.component.scss']

})

export class AppComponent {

list = [];

constructor() {

this.list = this.getData();

console.log(this.list);

}

getData(): Student[] {

let list: Student[] = [{

"id": 1,

"first_name": "Elmer",

"last_name": "Huriche",

"email": "[email protected]",

"gender": "Male"

}, {

"id": 2,

"first_name": "Eziechiele",

"last_name": "Mulvin",

"email": "[email protected]",

"gender": "Male"

}, {

"id": 3,

"first_name": "Joannes",

"last_name": "Woolvett",

"email": "[email protected]",

"gender": "Female"

}, {

"id": 4,

"first_name": "Roxana",

"last_name": "Irwin",

"email": "[email protected]",

"gender": "Female"

}, {

"id": 5,

"first_name": "Ethelind",

"last_name": "Murtagh",

"email": "[email protected]",

"gender": "Female"

}];

return list;

}

}

Output:

▼ Array(5) aRp.component.ts 16 e: id: 1, first name: Elmer, last name: Huriche, email:ehuriche0@hostgator.com, gender: M

Add a comment
Know the answer?
Add Answer to:
.Create a variable whose type is an array of that class you just previously created. Imagine that the array is initialized with a bunch of data from an API response. Create a statement that will...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA I. Using the Event Class created previously, create an array of objects;        II. Demonstrate...

    JAVA I. Using the Event Class created previously, create an array of objects;        II. Demonstrate passing array reference to a method;        III. Demonstrate creating array of objects that prints out only x 0.0 for all objects. PROJECT 5C - ARRAYS Create a new file called " EventArray5C". There are some "challenging" directions in this project. . 1.Prepare a document box (tell me that task(s) the application is to accomplish, how it will accomplish the tasks, the author of...

  • You may not add any instance variables to any class, though you may create local variables...

    You may not add any instance variables to any class, though you may create local variables inside of a method to accomplish its task. No other methods should be created other than the ones listed here.    Step 1 Develop the following class: Class Name: CollegeDegree Access Modifier: public Instance variables Name: major Access modifier: private Data type: String Name: numberOfCourses Access modifier: private Data type: int Name: courseNameArray Access modifier: private Data type: String [ ] Name: courseCreditArray Access...

  • You may not add any instance variables to any class, though you may create local variables...

    You may not add any instance variables to any class, though you may create local variables inside of a method to accomplish its task. No other methods should be created other than the ones listed here. (I need step 2 please.) Step 1 Develop the following class: Class Name: CollegeDegree Access Modifier: public Instance variables Name: major Access modifier: private Data type: String Name: numberOfCourses Access modifier: private Data type: int Name: courseNameArray Access modifier: private Data type: String [...

  • Maze Solving with Stacks Problem Statement Consider a maze made up of rectangular array of squares,...

    Maze Solving with Stacks Problem Statement Consider a maze made up of rectangular array of squares, such as the following one: X X X X X X X X X X X X X           X            X X X X    X X X           X               X     X X X     X X    X    X     X     X X X         X          X             X X X     X X X X X                X X X X X X X X X X X X X Figure...

  • Additional code needed: PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an...

    Additional code needed: PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an order at a fast-food burger joint. This class will be used in Part B, when we work with a list of orders. As vou work through this part and Part B, draw a UML diagram of each class in using the UML drawing tool 1) Create a new Lab5TestProject project in Netbeans, right-click on the lab5testproject package and select New>Java Class 2) Call your...

  • Assignment Overview In Part 1 of this assignment, you will write a main program and several...

    Assignment Overview In Part 1 of this assignment, you will write a main program and several classes to create and print a small database of baseball player data. The assignment has been split into two parts to encourage you to code your program in an incremental fashion, a technique that will be increasingly important as the semester goes on. Purpose This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT