Skip to main content

Hackerrank JavaScript Certification Intermediate Solutions

 HackerRank JavaScript Intermediate Text Certification Solution

class Image {

    // Add methods here

    url;

    height;

    width;

    constructor(url, size){

        this.url = url;

        this.height = size.height;

        this.width = size.width

        console.log(size)

    }

    getUrl(){

        return this.url;

    }

    setUrl(url){

        this.url =  url;

    }

    setSize(width,height) {

        this.width = width;

        this.height = height;

    }

    getSize(){

        return new Size(this.width, this.height)

    }

    cloneImage(){

        return new Image(this.url, new Size(this.width, this.height))

    }

}


Comments

Popular posts from this blog

HackerRank JavaScript Certification Intermediate Solutions

 'use strict'; const fs = require('fs'); const https = require('https'); process.stdin.resume(); process.stdin.setEncoding('utf-8'); let inputString = ''; let currentLine = 0; process.stdin.on('data', function(inputStdin) {       inputString += inputStdin; }); process.stdin.on('end', function() {     inputString = inputString.split('\n');     main(); }); function readLine() {       return inputString[currentLine++]; } const axios =  require('axios'); async function getNumTransactions(username) {     // write your code here     // API endpoint: https://jsonmock.hackerrank.com/api/article_users?username=<username>     // API endpoint: https://jsonmock.hackerrank.com/api/transactions?&userId=<userId>     try {         const {data} = await axios.get(`https://jsonmock.hackerrank.com/api/article_users?username=${username}`);         if(dat...

Calculator In Java Language

Java Swing is a GUI (graphical user Interface) widget toolkit for Java. Java Swing is a part of Oracle’s Java foundation classes . Java Swing is an API for providing graphical user interface elements to Java Programs.Swing was created to provide more powerful and flexible components than Java AWT (Abstract Window Toolkit). In this article we will use Java Swing components to create a simple calculator with only +, -, /, * operations. add(Component c) : adds component to container. addActionListenerListener(ActionListener d) : add actionListener for specified component setBackground(Color c) : sets the background color of the specified container setSize(int a, int b) : sets the size of container to specified dimensions. setText(String s) : sets the text of the label to s. getText() : returns the text of the label. Java program to create a simple calculator with basic +, -, /, * using java swing elements.  import javax.swing.*; import java.awt.event.*; import java.awt.*; public class...