5-Laboratoriya ishi Vektor qabul qiladigan funksiya



Download 24,81 Kb.
Sana11.01.2022
Hajmi24,81 Kb.
#348180
Bog'liq
paradigma5


5-Laboratoriya ishi


Vektor qabul qiladigan funksiya
public static void CalculateNoisePosition(ref T position, float offset, float scale){
Type vector = position.GetType();

MethodInfo add = vector.GetMethod("op_Addition", new[] {typeof(T), typeof(T)});

MethodInfo multiply = vector.GetMethod("op_Multiply", new[] {typeof(T), typeof(float)});
T one = (T) vector.GetProperty("one").GetValue(null);
position = (T) add.Invoke(null, new object[] {position, multiply.Invoke(null, new object[] {one, offset + 0.1f})});

position = (T) multiply.Invoke(null, new object[] {position, scale});

}
Shakllar yuzasini hisoblash


Aylana:

class AreaOfCircle



{

   public static void main(String args[])

    {  

      

      Scanner s= new Scanner(System.in);

        

         System.out.println("Enter the radius:");

         double r= s.nextDouble();

         double  area=(22*r*r)/7 ;

         System.out.println("Area of Circle is: " + area);      

   }

}

Konus:

package SurfaceAreaPrograms;

import java.util.Scanner;

public class VolumeOfCone {

private static Scanner sc;

public static void main(String[] args) {

double radius, height;

// LSA = Lateral Surface Area of a Cone, SA = Surface Area

double length, SA, Volume, LSA;

sc = new Scanner(System.in);

System.out.println("\n Please Enter the Radius of a Cone : ");

radius = sc.nextDouble();

System.out.println("\n Please Enter the Height of a Cone : ");

height = sc.nextDouble();

length = Math.sqrt(radius * radius + height * height);

SA = Math.PI * radius * (radius + length);

Volume = (1.0/3) * Math.PI * radius * radius * height;

LSA = Math.PI * radius * length;

System.out.format("\n The Length of a Side (Slant)of a Cone = %.2f", length);

System.out.format("\n The Surface area of a Cone = %.2f", SA);

System.out.format("\n The Volume of a Cone = %.2f", Volume);

System.out.format("\n The Lateral Surface area of a Cone = %.2f", LSA);

}

}

Silindr:




package org.arpit.java2blog;

 

import java.util.Scanner;



 

public class TotalSurfaceAreaCylinderMain {

 

    public static void main(String[] args) {



 

         Scanner s= new Scanner(System.in);

 

         System.out.println("Enter the radius of cylinder :");



 

        double r=s.nextDouble();

 

        System.out.println("Enter the height of cylinder :");



 

        double h=s.nextDouble();

 

         double surfaceAreaOfCylinder= 2 * Math.PI * r * r + 2 * Math.PI * r * h;



 

         System.out.println("Total surface area of cylinder is: "+surfaceAreaOfCylinder);

 

         s.close();



    }

 

}



 

Generic Class

import java.lang.reflect.InvocationHandler;

import java.lang.reflect.Method;

import java.lang.reflect.Proxy;
interface SomeContainer {

E createContents();

}
public class Main {
@SuppressWarnings("unchecked")

public static SomeContainer createSomeContainer() {

return (SomeContainer) Proxy.newProxyInstance(Main.class.getClassLoader(),

new Class[]{ SomeContainer.class }, new InvocationHandler() {

@Override

public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

Class returnType = method.getReturnType();

return returnType.newInstance();

}

});

}
public static void main(String[] args) {

SomeContainer container = createSomeContainer();
[*] System.out.println("String created: [" +container.createContents()+"]");
}

}

Download 24,81 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish