En java:
/*** @(#)Text1.java
*
*
* @Martha Fer IC. Rairame
* @version 1.00 2021/4/9
*/
import java.util.Scanner;
import java.util.StringTokenizer;
public class Tokens{
public static void main(String[ ]args) {
Scanner keyboard = new Scanner(System.in);
System.out.println("ingresa tu nombre y tu apellido");
String delimiters = " , ";
String inputLine = keyboard.nextLine();
StringTokenizer nameFactory = new StringTokenizer (inputLine , delimiters);
String nombre = nameFactory.nextToken();
String apellido = nameFactory.nextToken();
System.out.println("Hola"+nombre+" "+ apellido);
}
}
Calculo de temperatura:
package celsius;
import java.util.Scanner;
public class celsius {
double gradosF;
double gradosC = (gradosF-32)/9;
public static void main (string [] args) {
Scanner keyboard = new scanner(System.in);
System.out.prntln("ingresa el valor en grados F") ;
gradosF= keyboard.nextDouble();
System.out.prntln("El valor en grados C, es:" + gradosC) ;
}
}
Programación en c sharp:
using System;
using System.Drawing;
using System.Drawing.Imaging;
class Example_SetJPEGQuality
{
public static void Main()
{
Bitmap myBitmap;
ImageCodecInfo myImageCodecInfo;
Encoder myEncoder;
EncoderParameter myEncoderParameter;
EncoderParameters myEncoderParameters;
// Create a Bitmap object based on a BMP file.
myBitmap = new Bitmap("Shapes.bmp");
// Get an ImageCodecInfo object that represents the JPEG codec.
myImageCodecInfo = GetEncoderInfo("image/jpeg");
// Create an Encoder object based on the GUID
// for the Quality parameter category.
myEncoder = Encoder.Quality;
// Create an EncoderParameters object.
// An EncoderParameters object has an array of EncoderParameter
// objects. In this case, there is only one
// EncoderParameter object in the array.
myEncoderParameters = new EncoderParameters(1);
// Save the bitmap as a JPEG file with quality level 75.
myEncoderParameter = new EncoderParameter(myEncoder, 75L);
myEncoderParameters.Param[0] = myEncoderParameter;
myBitmap.Save("Shapes075.jpg", myImageCodecInfo, myEncoderParameters);
}
private static ImageCodecInfo GetEncoderInfo(String mimeType)
{
int j;
ImageCodecInfo[] encoders;
encoders = ImageCodecInfo.GetImageEncoders();
for(j = 0; j < encoders.Length; ++j)
{
if(encoders[j].MimeType == mimeType)
return encoders[j];
}
return null;
}
}
ref: https://docs.microsoft.com/es-es/dotnet/api/system.drawing.image.save?view=dotnet-plat-ext-5.0
No hay comentarios:
Publicar un comentario
Si gustas puedes dejar un comentario.